- xpath.c: applied another XPath patch from TOM
- xpath.c include/makefile.am: applied another patch from
  china@thewrittenword.com (cleanup on IRIX).
Daniel
diff --git a/ChangeLog b/ChangeLog
index 8a64317..c4a723d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Oct 27 18:57:32 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
+
+	* xpath.c: applied another XPath patch from TOM 
+	* xpath.c include/makefile.am: applied another patch from 
+	  china@thewrittenword.com (cleanup on IRIX).
+
 Fri Oct 27 13:45:28 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
 
 	* xml-config.1: received a fixed version from Fredrik Hallenberg
diff --git a/include/Makefile.am b/include/Makefile.am
index c8b4995..b4326dd 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -3,7 +3,6 @@
 xmlincdir = $(includedir)
 
 xmlinc_HEADERS = \
-		libxml/xmlversion.h.in \
 		libxml/SAX.h \
 		libxml/entities.h \
 		libxml/encoding.h \
@@ -30,4 +29,4 @@
 install-exec-hook:
 	$(mkinstalldirs) $(DESTDIR)$(xmlincdir) $(DESTDIR)$(xmlincdir)/libxml
 
-EXTRA_DIST = win32config.h
+EXTRA_DIST = win32config.h libxml/xmlversion.h.in
diff --git a/xpath.c b/xpath.c
index c9d5ed6..83b8e97 100644
--- a/xpath.c
+++ b/xpath.c
@@ -3324,8 +3324,8 @@
  * xmlXPathNormalizeFunction:
  * @ctxt:  the XPath Parser context
  *
- * Implement the normalize() XPath function
- * The normalize function returns the argument string with white
+ * Implement the normalize-space() XPath function
+ * The normalize-space function returns the argument string with white
  * space normalized by stripping leading and trailing whitespace
  * and replacing sequences of whitespace characters by a single
  * space. Whitespace characters are the same allowed by the S production
@@ -3568,8 +3568,6 @@
  *
  * Implement the number() XPath function
  *
- * BUG: since we directly call xmlXPathStringEvalNumber(),
- *      number("-1") isn't evaluated in -1.0 but in NaN.
  */
 void
 xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) {
@@ -3648,6 +3646,7 @@
     } else {
 	valuePush(ctxt,
 		  xmlXPathNewNodeSet(cur->nodesetval->nodeTab[0]));
+	xmlXPathNumberFunction(ctxt, 1);
 	for (i = 1; i < cur->nodesetval->nodeNr; i++) {
 	    valuePush(ctxt,
 		      xmlXPathNewNodeSet(cur->nodesetval->nodeTab[i]));
@@ -3858,6 +3857,8 @@
  *  [31]   Digits ::=   [0-9]+
  *
  * Parse and evaluate a Number in the string
+ * In complement of the Number expression, this function also handles
+ * negative values : '-' Number.
  *
  * Returns the double value.
  */
@@ -3867,11 +3868,16 @@
     double ret = 0.0;
     double mult = 1;
     int ok = 0;
+    int isneg = 0;
 
     while (*cur == ' ') cur++;
-    if ((*cur != '.') && ((*cur < '0') || (*cur > '9'))) {
+    if ((*cur != '.') && ((*cur < '0') || (*cur > '9')) && (*cur != '-')) {
         return(xmlXPathNAN);
     }
+    if (*cur == '-') {
+	isneg = 1;
+	cur++;
+    }
     while ((*cur >= '0') && (*cur <= '9')) {
         ret = ret * 10 + (*cur - '0');
 	ok = 1;
@@ -3890,6 +3896,7 @@
     }
     while (*cur == ' ') cur++;
     if (*cur != 0) return(xmlXPathNAN);
+    if (isneg) ret = -ret;
     return(ret);
 }
 
@@ -4366,7 +4373,7 @@
 	    SKIP(2);
 	    SKIP_BLANKS;
 	    xmlXPathNodeCollectAndTest(ctxt, AXIS_DESCENDANT_OR_SELF,
-			     NODE_TEST_TYPE, XML_ELEMENT_NODE, NULL, NULL);
+			     NODE_TEST_TYPE, NODE_TYPE_NODE, NULL, NULL);
 	    ctxt->context->node = NULL;
 	    xmlXPathEvalRelativeLocationPath(ctxt);
 	} else if (CUR == '/') {
@@ -5083,7 +5090,7 @@
 	SKIP(2);
 	SKIP_BLANKS;
 	xmlXPathNodeCollectAndTest(ctxt, AXIS_PARENT,
-			 NODE_TEST_TYPE, XML_ELEMENT_NODE, NULL, NULL);
+			 NODE_TEST_TYPE, NODE_TYPE_NODE, NULL, NULL);
     } else if (CUR == '.') {
 	NEXT;
 	SKIP_BLANKS;
@@ -5195,7 +5202,7 @@
 	SKIP(2);
 	SKIP_BLANKS;
 	xmlXPathNodeCollectAndTest(ctxt, AXIS_DESCENDANT_OR_SELF,
-			 NODE_TEST_TYPE, XML_ELEMENT_NODE, NULL, NULL);
+			 NODE_TEST_TYPE, NODE_TYPE_NODE, NULL, NULL);
     } else if (CUR == '/') {
 	    NEXT;
 	SKIP_BLANKS;
@@ -5207,7 +5214,7 @@
 	    SKIP(2);
 	    SKIP_BLANKS;
 	    xmlXPathNodeCollectAndTest(ctxt, AXIS_DESCENDANT_OR_SELF,
-			     NODE_TEST_TYPE, XML_ELEMENT_NODE, NULL, NULL);
+			     NODE_TEST_TYPE, NODE_TYPE_NODE, NULL, NULL);
 	    xmlXPathEvalStep(ctxt);
 	} else if (CUR == '/') {
 	    NEXT;
@@ -5249,7 +5256,7 @@
 		SKIP_BLANKS;
 		xmlXPathNodeCollectAndTest(ctxt,
 		                 AXIS_DESCENDANT_OR_SELF, NODE_TEST_TYPE,
-				 XML_ELEMENT_NODE, NULL, NULL);
+				 NODE_TYPE_NODE, NULL, NULL);
 		xmlXPathEvalRelativeLocationPath(ctxt);
 	    } else if (CUR == '/') {
 		NEXT;
@@ -5292,9 +5299,9 @@
 	xmlXPathRoot(ctxt);
     xmlXPathEvalExpr(ctxt);
 
-    if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_NODESET)) {
+    if (ctxt->value == NULL) {
 	xmlGenericError(xmlGenericErrorContext,
-		"xmlXPathEval: evaluation failed to return a node set\n");
+		"xmlXPathEval: evaluation failed\n");
     } else {
 	res = valuePop(ctxt);
     }
@@ -5394,8 +5401,6 @@
                          xmlXPathNamespaceURIFunction);
     xmlXPathRegisterFunc(ctxt, (const xmlChar *)"normalize-space",
                          xmlXPathNormalizeFunction);
-    xmlXPathRegisterFunc(ctxt, (const xmlChar *)"normalize",
-                         xmlXPathNormalizeFunction);
     xmlXPathRegisterFunc(ctxt, (const xmlChar *)"number",
                          xmlXPathNumberFunction);
     xmlXPathRegisterFunc(ctxt, (const xmlChar *)"position",