XPath compiler support for the namespace axis
This commit is contained in:
parent
07b52fb48a
commit
67bc338474
|
@ -359,6 +359,23 @@ module Oga
|
|||
.followed_by(each_node)
|
||||
end
|
||||
|
||||
# @param [AST::Node] ast
|
||||
# @param [Oga::Ruby::Node] input
|
||||
# @return [Oga::Ruby::Node]
|
||||
def on_axis_namespace(ast, input)
|
||||
underscore = literal('_')
|
||||
node = node_literal
|
||||
|
||||
name = string(ast.children[1])
|
||||
star = string(STAR)
|
||||
|
||||
input.is_a?(XML::Element).if_true do
|
||||
input.available_namespaces.each.add_block(underscore, node) do
|
||||
node.name.eq(name).or(name.eq(star)).if_true { yield node }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# @param [AST::Node] ast
|
||||
# @param [Oga::Ruby::Node] input
|
||||
# @return [Oga::Ruby::Node]
|
||||
|
|
Loading…
Reference in New Issue