fixed problem with union when last() is used in predicate (bug #131971)
* xpath.c: fixed problem with union when last() is used
in predicate (bug #131971)
* xpointer.c: minor change to comment for doc generation
diff --git a/xpath.c b/xpath.c
index 4b0ca11..445a24b 100644
--- a/xpath.c
+++ b/xpath.c
@@ -9846,6 +9846,10 @@
int total = 0, cur;
xmlXPathCompExprPtr comp;
xmlXPathObjectPtr arg1, arg2;
+ xmlNodePtr bak;
+ xmlDocPtr bakd;
+ int pp;
+ int cs;
CHECK_ERROR0;
comp = ctxt->comp;
@@ -9853,6 +9857,10 @@
case XPATH_OP_END:
return (0);
case XPATH_OP_UNION:
+ bakd = ctxt->context->doc;
+ bak = ctxt->context->node;
+ pp = ctxt->context->proximityPosition;
+ cs = ctxt->context->contextSize;
total =
xmlXPathCompOpEvalLast(ctxt, &comp->steps[op->ch1], last);
CHECK_ERROR0;
@@ -9869,6 +9877,10 @@
nodesetval->nodeNr -
1];
}
+ ctxt->context->doc = bakd;
+ ctxt->context->node = bak;
+ ctxt->context->proximityPosition = pp;
+ ctxt->context->contextSize = cs;
cur =
xmlXPathCompOpEvalLast(ctxt, &comp->steps[op->ch2], last);
CHECK_ERROR0;