Proper support for the XPath "following" axis.
This commit is contained in:
parent
57fcbbd0fc
commit
211caf00c6
|
@ -252,15 +252,22 @@ module Oga
|
||||||
nodes = XML::NodeSet.new
|
nodes = XML::NodeSet.new
|
||||||
|
|
||||||
context.each do |context_node|
|
context.each do |context_node|
|
||||||
current = context_node
|
check = false
|
||||||
|
|
||||||
# TODO: implement me properly this time.
|
@document.each_node do |doc_node|
|
||||||
#
|
# Skip child nodes of the current context node, compare all
|
||||||
# Step 1: gather *all* the nodes that come after the current node,
|
# following nodes.
|
||||||
# regardless of their nesting.
|
if doc_node == context_node
|
||||||
#
|
check = true
|
||||||
# Step 2: compare all those nodes with the given test, only return
|
throw :skip_children
|
||||||
# those that match.
|
end
|
||||||
|
|
||||||
|
next unless check
|
||||||
|
|
||||||
|
if can_match_node?(doc_node) and node_matches?(doc_node, node)
|
||||||
|
nodes << doc_node
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return nodes
|
return nodes
|
||||||
|
|
Loading…
Reference in New Issue