fixed a weird namespace bug #141532 added tests to the regression for bug
authorDaniel Veillard <veillard@src.gnome.org>
Sun, 16 May 2004 15:02:15 +0000 (15:02 +0000)
committerDaniel Veillard <veillard@src.gnome.org>
Sun, 16 May 2004 15:02:15 +0000 (15:02 +0000)
* libxslt/xslt.c: fixed a weird namespace bug #141532
* tests/docs/Makefile.am tests/docs/bug-14[89].xml
  tests/general/Makefile.am tests/docs/bug-14[89]*: added tests
  to the regression for bug #141532
Daniel

ChangeLog
libxslt/xslt.c
tests/docs/Makefile.am
tests/docs/bug-148.xml [new file with mode: 0644]
tests/docs/bug-149.xml [new file with mode: 0644]
tests/general/Makefile.am
tests/general/bug-148.out [new file with mode: 0644]
tests/general/bug-148.xsl [new file with mode: 0644]
tests/general/bug-149.out [new file with mode: 0644]
tests/general/bug-149.xsl [new file with mode: 0644]

index 65b439a..4351241 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sun May 16 11:01:52 CEST 2004 Daniel Veillard <daniel@veillard.com>
+
+       * libxslt/xslt.c: fixed a weird namespace bug #141532
+       * tests/docs/Makefile.am tests/docs/bug-14[89].xml
+         tests/general/Makefile.am tests/docs/bug-14[89]*: added tests
+         to the regression for bug #141532
+
 Sun May  2 23:47:43 PDT 2004 William Brack <wbrack@mmm.com.hk>
 
        * libxslt/imports.c: added comments and function header,
index fd355d1..85937bb 100644 (file)
@@ -1222,8 +1222,9 @@ xsltPrecomputeStylesheet(xsltStylesheetPtr style, xmlNodePtr cur) {
                        moved = 0;
                        next = ns->next;
                        for (i = 0;i < style->exclPrefixNr;i++) {
-                           if (xmlStrEqual(ns->href,
-                                           style->exclPrefixTab[i])) {
+                           if ((ns->prefix != NULL) && 
+                               (xmlStrEqual(ns->href,
+                                            style->exclPrefixTab[i]))) {
                                /*
                                 * Move the namespace definition on the root
                                 * element to avoid duplicating it without
index 5c57fcd..e99d788 100644 (file)
@@ -147,6 +147,8 @@ EXTRA_DIST =        \
        bug-145.xml \
        bug-146.xml \
        bug-147.xml \
+       bug-148.xml \
+       bug-149.xml \
        character.xml \
        array.xml \
        items.xml
diff --git a/tests/docs/bug-148.xml b/tests/docs/bug-148.xml
new file mode 100644 (file)
index 0000000..69d62f2
--- /dev/null
@@ -0,0 +1 @@
+<doc/>
diff --git a/tests/docs/bug-149.xml b/tests/docs/bug-149.xml
new file mode 100644 (file)
index 0000000..69d62f2
--- /dev/null
@@ -0,0 +1 @@
+<doc/>
index 202adda..e8edbe9 100644 (file)
@@ -155,6 +155,8 @@ EXTRA_DIST = \
     bug-147.out bug-147.xsl \
     bug-147-1.imp bug-147-2.imp bug-147-3.imp \
     bug-147-4.imp bug-147-5.imp bug-147-6.imp \
+    bug-148.out bug-148.xsl \
+    bug-149.out bug-149.xsl \
     character.out character.xsl \
     character2.out character2.xsl \
     itemschoose.out itemschoose.xsl \
diff --git a/tests/general/bug-148.out b/tests/general/bug-148.out
new file mode 100644 (file)
index 0000000..f4e5164
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<foo/>
diff --git a/tests/general/bug-148.xsl b/tests/general/bug-148.xsl
new file mode 100644 (file)
index 0000000..7c5feea
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version='1.0' encoding='utf-8'?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:ns1="http://www.example.com/ns1"
+               exclude-result-prefixes="ns1"
+                version="1.0">
+<foo xmlns="http://www.example.com/ns1"/>
+
+<xsl:template match="/">
+  <xsl:element name="foo"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/tests/general/bug-149.out b/tests/general/bug-149.out
new file mode 100644 (file)
index 0000000..f4e5164
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<foo/>
diff --git a/tests/general/bug-149.xsl b/tests/general/bug-149.xsl
new file mode 100644 (file)
index 0000000..5c2fe92
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version='1.0' encoding='utf-8'?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+<foo xmlns="http://www.example.com/ns1"/>
+
+<xsl:template match="/">
+  <xsl:element name="foo"/>
+</xsl:template>
+
+</xsl:stylesheet>