fixed bug #104817 with delegateURI fixing bugs #104123 and #104125 Daniel
* catalog.c: fixed bug #104817 with delegateURI
* xpath.c: fixing bugs #104123 and #104125
Daniel
diff --git a/ChangeLog b/ChangeLog
index e0e1f6a..93c146f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Feb 4 20:26:22 CET 2003 Daniel Veillard <daniel@veillard.com>
+
+ * catalog.c: fixed bug #104817 with delegateURI
+ * xpath.c: fixing bugs #104123 and #104125
+
Tue Feb 4 17:12:56 CET 2003 Daniel Veillard <daniel@veillard.com>
* configure.in valid.c xmlreader.c python/libxml_wrap.h
diff --git a/catalog.c b/catalog.c
index e0159e2..c7da306 100644
--- a/catalog.c
+++ b/catalog.c
@@ -1705,7 +1705,8 @@
*/
cur = catal;
while (cur != NULL) {
- if ((cur->type == XML_CATA_DELEGATE_SYSTEM) &&
+ if (((cur->type == XML_CATA_DELEGATE_SYSTEM) ||
+ (cur->type == XML_CATA_DELEGATE_URI)) &&
(!xmlStrncmp(URI, cur->name, xmlStrlen(cur->name)))) {
for (i = 0;i < nbList;i++)
if (xmlStrEqual(cur->URL, delegates[i]))
diff --git a/xpath.c b/xpath.c
index 86163f1..4bbb7dd 100644
--- a/xpath.c
+++ b/xpath.c
@@ -53,6 +53,10 @@
#include <libxml/threads.h>
#include <libxml/globals.h>
+/*
+ * TODO: when compatibility allows remove all "fake node libxslt" strings
+ * the test should just be name[0] = ' '
+ */
/* #define DEBUG */
/* #define DEBUG_STEP */
/* #define DEBUG_STEP_NTH */
@@ -1676,6 +1680,9 @@
if (val == NULL) return;
+ if ((val->type == XML_ELEMENT_NODE) && (val->name[0] == ' '))
+ return; /* an XSLT fake node */
+
/* @@ with_ns to check wether namespace nodes should be looked at @@ */
/*
* check against doublons
@@ -1731,6 +1738,9 @@
xmlXPathNodeSetAddUnique(xmlNodeSetPtr cur, xmlNodePtr val) {
if (val == NULL) return;
+ if ((val->type == XML_ELEMENT_NODE) && (val->name[0] == ' '))
+ return; /* an XSLT fake node */
+
/* @@ with_ns to check wether namespace nodes should be looked at @@ */
/*
* grow the nodeTab if needed
@@ -5269,8 +5279,9 @@
if (ctxt->context->node->parent == NULL)
return((xmlNodePtr) ctxt->context->doc);
if ((ctxt->context->node->parent->type == XML_ELEMENT_NODE) &&
- (xmlStrEqual(ctxt->context->node->parent->name,
- BAD_CAST "fake node libxslt")))
+ ((ctxt->context->node->parent->name[0] == ' ') ||
+ (xmlStrEqual(ctxt->context->node->parent->name,
+ BAD_CAST "fake node libxslt"))))
return(NULL);
return(ctxt->context->node->parent);
case XML_ATTRIBUTE_NODE: {
@@ -5340,8 +5351,9 @@
if (ctxt->context->node->parent == NULL)
return((xmlNodePtr) ctxt->context->doc);
if ((ctxt->context->node->parent->type == XML_ELEMENT_NODE) &&
- (xmlStrEqual(ctxt->context->node->parent->name,
- BAD_CAST "fake node libxslt")))
+ ((ctxt->context->node->parent->name[0] == ' ') ||
+ (xmlStrEqual(ctxt->context->node->parent->name,
+ BAD_CAST "fake node libxslt"))))
return(NULL);
return(ctxt->context->node->parent);
case XML_ATTRIBUTE_NODE: {
@@ -5391,7 +5403,9 @@
if (cur->parent == NULL)
return(NULL);
if ((cur->parent->type == XML_ELEMENT_NODE) &&
- (xmlStrEqual(cur->parent->name, BAD_CAST "fake node libxslt")))
+ ((cur->parent->name[0] == ' ') ||
+ (xmlStrEqual(cur->parent->name,
+ BAD_CAST "fake node libxslt"))))
return(NULL);
return(cur->parent);
case XML_ATTRIBUTE_NODE: {
@@ -5959,7 +5973,10 @@
case XML_ELEMENT_NODE:
case XML_ATTRIBUTE_NODE:
case XML_PI_NODE:
- valuePush(ctxt,
+ if (cur->nodesetval->nodeTab[i]->name[0] == ' ')
+ valuePush(ctxt, xmlXPathNewCString(""));
+ else
+ valuePush(ctxt,
xmlXPathNewString(cur->nodesetval->nodeTab[i]->name));
break;
case XML_NAMESPACE_DECL:
@@ -6069,13 +6086,15 @@
switch (cur->nodesetval->nodeTab[i]->type) {
case XML_ELEMENT_NODE:
case XML_ATTRIBUTE_NODE:
- if ((cur->nodesetval->nodeTab[i]->ns == NULL) ||
- (cur->nodesetval->nodeTab[i]->ns->prefix == NULL))
+ if (cur->nodesetval->nodeTab[i]->name[0] == ' ')
+ valuePush(ctxt, xmlXPathNewCString(""));
+ else if ((cur->nodesetval->nodeTab[i]->ns == NULL) ||
+ (cur->nodesetval->nodeTab[i]->ns->prefix == NULL)) {
valuePush(ctxt,
xmlXPathNewString(cur->nodesetval->
nodeTab[i]->name));
- else {
+ } else {
char name[2000];
snprintf(name, sizeof(name), "%s:%s",