fixed problem concerning XPath context corruption during function argument

* xpath.c: fixed problem concerning XPath context corruption
  during function argument evaluation (bug 157652)
diff --git a/ChangeLog b/ChangeLog
index 49f3584..5c56a49 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Nov  9 10:21:37 GMT 2004 William Brack <wbrack@mmm.com.hk>
+
+	* xpath.c: fixed problem concerning XPath context corruption
+	  during function argument evaluation (bug 157652)
+	  
 Mon Nov  8 18:54:52 CET 2004 Daniel Veillard <daniel@veillard.com>
 
 	* testapi.c: more types.
diff --git a/xpath.c b/xpath.c
index 9683832..fad8c26 100644
--- a/xpath.c
+++ b/xpath.c
@@ -10437,10 +10437,14 @@
         case XPATH_OP_ARG:
 	    bakd = ctxt->context->doc;
 	    bak = ctxt->context->node;
+	    pp = ctxt->context->proximityPosition;
+	    cs = ctxt->context->contextSize;
             if (op->ch1 != -1)
                 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
-	    ctxt->context->doc = bakd;
+	    ctxt->context->contextSize = cs;
+	    ctxt->context->proximityPosition = pp;
 	    ctxt->context->node = bak;
+	    ctxt->context->doc = bakd;
 	    CHECK_ERROR0;
             if (op->ch2 != -1) {
                 total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]);