fixed a problem with exclude-result-prefixes (bug 165560)
authorWilliam M. Brack <wbrack@src.gnome.org>
Mon, 14 Feb 2005 15:12:42 +0000 (15:12 +0000)
committerWilliam M. Brack <wbrack@src.gnome.org>
Mon, 14 Feb 2005 15:12:42 +0000 (15:12 +0000)
* libxslt/namespaces.c: fixed a problem with
  exclude-result-prefixes (bug 165560)

ChangeLog
libxslt/namespaces.c

index f5ed1f9..a753186 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Feb 14 23:10:21 HKT 2005 William Brack <wbrack@mmm.com.hk>
+
+       * libxslt/namespaces.c: fixed a problem with
+         exclude-result-prefixes (bug 165560)
+
 Mon Feb 14 12:51:07 CET 2005 Daniel Veillard <daniel@veillard.com>
 
        * libxslt/variables.c: added a cretion of ctxt->globalVars in
index 6a5b080..0589d04 100644 (file)
@@ -446,11 +446,18 @@ xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns,
         */
        if ((ret == NULL) && (ns->prefix != NULL))
            ret = xmlSearchNsByHref(out->doc, out, URI);
-       }
+    }
 
-    if (ret == NULL) { /* if no success and an element node, create the ns */
-       if (out->type == XML_ELEMENT_NODE)
-           ret = xmlNewNs(out, URI, ns->prefix);
+    /*
+     * For an element node, if we don't find it, or it's the default
+     * and this element already defines a default (bug 165560), we need to
+     * create it.
+     */
+    if (out->type == XML_ELEMENT_NODE) {
+       if ((ret == NULL) || ((ret->prefix == NULL) && (out->ns == NULL) &&
+           (out->nsDef != NULL) && (!xmlStrEqual(URI, out->nsDef->href)))) {
+               ret = xmlNewNs(out, URI, ns->prefix);
+       }
     }
     return(ret);
 }