class Gammo::XPath::AST::Axis::Attribute

Public Instance Methods

strain(context, context_node, node_set) click to toggle source
# File lib/gammo/xpath/ast/axis.rb, line 74
def strain(context, context_node, node_set)
  if node_test.instance_of?(NodeTest::Name) && node_test.local != ?*
    attribute =
      if !node_test.namespace
        context_node.get_attribute_node(node_test.local)
      else
        # TODO: Test this properly.
        context_node.get_attribute_node(node_test.local, namespace: node_test.namespace)
      end
    if attribute && attribute.namespace != 'http://www.w3.org/XML/1998/namespace'
      node_set << attribute if node_test.match?(attribute)
    end
    return
  end

  node_set.concat(context_node.attributes.select { |attribute|
    node_test.match?(attribute)
  })
end