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/ChangeLog b/ChangeLog
index 1bd1208..2b51231 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Jan 22 10:43:22 HKT 2004 William Brack <wbrack@mmm.com.hk>
+
+	* xpath.c: fixed problem with union when last() is used
+	  in predicate (bug #131971)
+	* xpointer.c: minor change to comment for doc generation
+
 Wed Jan 21 17:03:17 CET 2004 Daniel Veillard <daniel@veillard.com>
 
 	* parser.c: fixed bug #131745 raised by Shaun McCance with the
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;
diff --git a/xpointer.c b/xpointer.c
index 145b134..de09824 100644
--- a/xpointer.c
+++ b/xpointer.c
@@ -2290,6 +2290,7 @@
 /**
  * xmlXPtrAdvanceNode:
  * @cur:  the node
+ * @level: incremented/decremented to show level in tree
  *
  * Advance to the next element or text node in document order
  * TODO: add a stack for entering/exiting entities