Skip to content

Commit 42c4307

Browse files
committed
Optimize XPath step
If a predicate of xpath is position-independent, we don't need to create nodesets that has many duplicated nodes with different positions. Implements optimization of preceding-sibling/following-sibling with simple positional predicates as an example. We can add more optimizations for other axis in the future.
1 parent 1317467 commit 42c4307

6 files changed

Lines changed: 542 additions & 328 deletions

File tree

lib/rexml/functions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def Functions::last( )
5353
end
5454

5555
def Functions::position( )
56-
@@context[:index]
56+
@@context[:position]
5757
end
5858

5959
# Returns the size of the given list of nodes.

0 commit comments

Comments
 (0)