From c1d69b8ead5c940f7ac58e0cc62d5d7dce650318 Mon Sep 17 00:00:00 2001 From: Alex Simkin Date: Mon, 28 May 2018 13:33:37 +1000 Subject: [PATCH] Fix position of last (marked) element in PredicateContext. --- .../java/com/github/simy4/xpath/expr/AbstractStepExpr.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xpath-to-xml-core/src/main/java/com/github/simy4/xpath/expr/AbstractStepExpr.java b/xpath-to-xml-core/src/main/java/com/github/simy4/xpath/expr/AbstractStepExpr.java index 91771bd0..f2aeefbe 100644 --- a/xpath-to-xml-core/src/main/java/com/github/simy4/xpath/expr/AbstractStepExpr.java +++ b/xpath-to-xml-core/src/main/java/com/github/simy4/xpath/expr/AbstractStepExpr.java @@ -148,8 +148,10 @@ private final class PredicateContext implements Function apply(NodeView view) { - this.last = null == last || !last.isNew() ? view : last; - this.position++; + if (null == last || !last.isNew()) { + last = view; + position++; + } return view; }