added a newline for any comment before the root element (Bug 130433) fixed
authorWilliam M. Brack <wbrack@src.gnome.org>
Fri, 16 Jan 2004 14:17:28 +0000 (14:17 +0000)
committerWilliam M. Brack <wbrack@src.gnome.org>
Fri, 16 Jan 2004 14:17:28 +0000 (14:17 +0000)
* libxslt/xsltutils.c: added a newline for any comment before
  the root element (Bug 130433)
* libxslt/xslt.c: fixed problem with cdata-section-elements when
  default namespace is changed (Bug 130793)
* tests/extensions/module.out, tests/general/bug-100.out: adjusted
  for newline after comment change above.
* tests/general/Makefile.am, tests/general/bug-140.xsl,
  tests/general/Makefile.am, tests/docs/bug-140.xml: added test for
  cdata-section-elements problem.

ChangeLog
libxslt/xslt.c
libxslt/xsltutils.c
tests/docs/Makefile.am
tests/docs/bug-140.xml [new file with mode: 0644]
tests/extensions/module.out
tests/general/Makefile.am
tests/general/bug-100.out
tests/general/bug-140.out [new file with mode: 0644]
tests/general/bug-140.xsl [new file with mode: 0644]

index 3454311..3d10819 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Fri Jan 16 22:15:34 HKT 2004 William Brack <wbrack@mmm.com.hk>
+
+       * libxslt/xsltutils.c: added a newline for any comment before
+         the root element (Bug 130433)
+       * libxslt/xslt.c: fixed problem with cdata-section-elements when
+         default namespace is changed (Bug 130793)
+       * tests/extensions/module.out, tests/general/bug-100.out: adjusted
+         for newline after comment change above.
+       * tests/general/Makefile.am, tests/general/bug-140.xsl,
+         tests/general/Makefile.am, tests/docs/bug-140.xml: added test for
+         cdata-section-elements problem.
+
 Wed Jan 14 16:44:58 CET 2004 Daniel Veillard <daniel@veillard.com>
 
        * python/libxsl.py: applied shared lib loading patch for OS X from
index b94fe3d..795d10d 100644 (file)
@@ -775,8 +775,21 @@ xsltParseStylesheetOutput(xsltStylesheetPtr style, xmlNodePtr cur)
                if (element == NULL) {
                    if (style != NULL) style->errors++;
                } else {
+                   xmlNsPtr ns;
+                   
                    xmlHashAddEntry2(style->cdataSection, element, URI,
                                     (void *) "cdata");
+                   /*
+                    * if prefix is NULL, we must check whether it's
+                    * necessary to also put in the name of the default
+                    * namespace.
+                    */
+                   if (URI == NULL) {
+                       ns = xmlSearchNs(style->doc, cur, NULL);
+                       if (ns != NULL)  
+                           xmlHashAddEntry2(style->cdataSection, element,
+                               ns->href, (void *) "cdata");
+                   }
                    xmlFree(element);
                }
             }
index a496c79..bc6f6a3 100644 (file)
@@ -1210,7 +1210,8 @@ xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result,
            while (child != NULL) {
                xmlNodeDumpOutput(buf, result, child, 0, (indent == 1),
                                  (const char *) encoding);
-               if (child->type == XML_DTD_NODE)
+               if ((child->type == XML_DTD_NODE) ||
+                   (child->type == XML_COMMENT_NODE))
                    xmlOutputBufferWriteString(buf, "\n");
                child = child->next;
            }
index 2f5511c..2c3f248 100644 (file)
@@ -139,6 +139,7 @@ EXTRA_DIST =        \
        bug-137.xml \
        bug-138.xml \
        bug-139.xml \
+       bug-140.xml \
        character.xml \
        array.xml \
        items.xml
diff --git a/tests/docs/bug-140.xml b/tests/docs/bug-140.xml
new file mode 100644 (file)
index 0000000..54a1d22
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
+<rootelement>
+  <childelement/>
+  <childelement/>
+</rootelement>
+
index eaed1c9..fa2cdd7 100644 (file)
@@ -1,2 +1,3 @@
 <?xml version="1.0"?>
-<!--libxslt:test element test worked-->SUCCESS
+<!--libxslt:test element test worked-->
+SUCCESS
index 5581c50..0e2e311 100644 (file)
@@ -145,6 +145,7 @@ EXTRA_DIST = \
     bug-137.imp  bug-137.out  bug-137.xsl \
     bug-138.out bug-138.xsl \
     bug-139.out bug-139.xsl \
+    bug-140.out bug-140.xsl \
     character.out character.xsl \
     character2.out character2.xsl \
     itemschoose.out itemschoose.xsl \
index 478b115..cba12dd 100644 (file)
@@ -1,2 +1,3 @@
 <?xml version="1.0"?>
 <!--libxslt:test element test worked-->
+
diff --git a/tests/general/bug-140.out b/tests/general/bug-140.out
new file mode 100644 (file)
index 0000000..93fcad5
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
+<script xmlns="http://www.w3.org/2000/svg" type="text/ecmascript"><![CDATA[
+  var foo2 = text;
+  ]]></script>
diff --git a/tests/general/bug-140.xsl b/tests/general/bug-140.xsl
new file mode 100644 (file)
index 0000000..777ef57
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
+
+<!DOCTYPE xsl:stylesheet [
+
+<!ENTITY bar "bar"> 
+
+<!ENTITY foo "var foo = &bar;"> 
+
+<!-- namespace for SVG -->
+<!ENTITY svgns "http://www.w3.org/2000/svg">
+<!-- namespace for XSLT -->
+<!ENTITY xsltns "http://www.w3.org/1999/XSL/Transform">
+
+]>
+
+<xsl:stylesheet version="1.0" 
+                xmlns="&svgns;" 
+                xmlns:xsl="&xsltns;"
+                exclude-result-prefixes="xsl">
+
+<xsl:output method="xml" indent="yes" encoding="iso-8859-1"
+standalone="yes" cdata-section-elements="script"/>
+
+<xsl:variable name="foo" select="'bar'"/>
+
+<xsl:template match="/">
+  <script type="text/ecmascript">
+  var foo2 = text;
+  </script>
+</xsl:template>            
+
+</xsl:stylesheet>