summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam M. Brack <wbrack@src.gnome.org>2004-01-12 16:36:42 +0000
committerWilliam M. Brack <wbrack@src.gnome.org>2004-01-12 16:36:42 +0000
commit32848e981e953cebb228ced594f7302ea4d85fa7 (patch)
tree2e77ef610b6c552330b8a49d7e10a4f3bc6cc88f
parentdb0a9ceffbc13b0ad84ed5d030360171c5a86ac1 (diff)
downloadlibxslt-32848e981e953cebb228ced594f7302ea4d85fa7.tar.gz
libxslt-32848e981e953cebb228ced594f7302ea4d85fa7.tar.bz2
libxslt-32848e981e953cebb228ced594f7302ea4d85fa7.zip
changed to assure comment which preceeds root node is output after DTD
* libxslt/transform.c: changed to assure comment which preceeds root node is output after DTD (Bug 130433) * test/exslt/common/node-set.4.*: added test case for Bug 130922
-rw-r--r--ChangeLog7
-rw-r--r--libxslt/transform.c12
-rw-r--r--tests/exslt/common/Makefile.am1
-rw-r--r--tests/exslt/common/node-set.4.out2
-rw-r--r--tests/exslt/common/node-set.4.xml37
-rw-r--r--tests/exslt/common/node-set.4.xsl37
6 files changed, 93 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 7e561dee..9dd53d9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Jan 13 00:33:50 HKT 2004 William Brack <wbrack@mmm.com.hk>
+
+ * libxslt/transform.c: changed to assure comment which
+ preceeds root node is output after DTD (Bug 130433)
+ * test/exslt/common/node-set.4.*: added test case for
+ Bug 130922
+
Mon Jan 12 12:51:45 HKT 2004 William Brack <wbrack@mmm.com.hk>
* doc/site.xsl: Changed logo spacing to avoid stacking
diff --git a/libxslt/transform.c b/libxslt/transform.c
index fe396517..c1343372 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -3855,7 +3855,7 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
{
xmlDocPtr res = NULL;
xsltTransformContextPtr ctxt = NULL;
- xmlNodePtr root;
+ xmlNodePtr root, node;
const xmlChar *method;
const xmlChar *doctypePublic;
const xmlChar *doctypeSystem;
@@ -4068,11 +4068,17 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
}
if (ctxt->type == XSLT_OUTPUT_XML) {
XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic)
- XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem)
- if (((doctypePublic != NULL) || (doctypeSystem != NULL)))
+ XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem)
+ if (((doctypePublic != NULL) || (doctypeSystem != NULL))) {
+ /* Need a small "hack" here to assure DTD comes before
+ possible comment nodes */
+ node = res->children;
+ res->children = NULL;
res->intSubset = xmlCreateIntSubset(res, root->name,
doctypePublic,
doctypeSystem);
+ res->children->next = node;
+ }
}
}
xmlXPathFreeNodeSet(ctxt->nodeList);
diff --git a/tests/exslt/common/Makefile.am b/tests/exslt/common/Makefile.am
index 42287ee4..759f27ab 100644
--- a/tests/exslt/common/Makefile.am
+++ b/tests/exslt/common/Makefile.am
@@ -7,6 +7,7 @@ EXTRA_DIST = \
node-set.1.xml node-set.1.xsl node-set.1.out \
node-set.2.xml node-set.2.xsl node-set.2.out \
node-set.3.xml node-set.3.xsl node-set.3.out \
+ node-set.4.xml node-set.4.xsl node-set.4.out \
object-type.1.xml object-type.1.xsl object-type.1.out \
import-test1a.imp import-test1b.imp import-test1.out \
import-test1.xml import-test1.xsl
diff --git a/tests/exslt/common/node-set.4.out b/tests/exslt/common/node-set.4.out
new file mode 100644
index 00000000..4295f031
--- /dev/null
+++ b/tests/exslt/common/node-set.4.out
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<initial>Mode of FOO is input</initial><post-transform>Mode of FOO is fiddled</post-transform>
diff --git a/tests/exslt/common/node-set.4.xml b/tests/exslt/common/node-set.4.xml
new file mode 100644
index 00000000..1464b0d1
--- /dev/null
+++ b/tests/exslt/common/node-set.4.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exsl="http://exslt.org/common"
+ version="1.0">
+
+<xsl:key name="tmpls" match="xsl:template" use="@name"/>
+
+<xsl:template match="/">
+ <xsl:message>
+ <xsl:text>Mode of FOO is </xsl:text>
+ <xsl:value-of select="key('tmpls', 'FOO')/@mode"/>
+ </xsl:message>
+
+ <xsl:variable name="fiddle">
+ <xsl:apply-templates select="//xsl:template"/>
+ </xsl:variable>
+
+ <xsl:apply-templates select="exsl:node-set($fiddle)" mode="faddle"/>
+</xsl:template>
+
+<xsl:template match="xsl:template">
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:attribute name="mode">fiddled</xsl:attribute>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="/" mode="faddle">
+ <xsl:message>
+ <xsl:text>Mode of FOO is </xsl:text>
+ <xsl:value-of select="key('tmpls', 'FOO')/@mode"/>
+ </xsl:message>
+</xsl:template>
+
+<xsl:template name="FOO" mode="input"/>
+
+</xsl:stylesheet>
diff --git a/tests/exslt/common/node-set.4.xsl b/tests/exslt/common/node-set.4.xsl
new file mode 100644
index 00000000..50c976c7
--- /dev/null
+++ b/tests/exslt/common/node-set.4.xsl
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exsl="http://exslt.org/common"
+ version="1.0">
+
+<xsl:key name="tmpls" match="xsl:template" use="@name"/>
+
+<xsl:template match="/">
+ <xsl:element name="initial">
+ <xsl:text>Mode of FOO is </xsl:text>
+ <xsl:value-of select="key('tmpls', 'FOO')/@mode"/>
+ </xsl:element>
+
+ <xsl:variable name="fiddle">
+ <xsl:apply-templates select="//xsl:template"/>
+ </xsl:variable>
+
+ <xsl:apply-templates select="exsl:node-set($fiddle)" mode="faddle"/>
+</xsl:template>
+
+<xsl:template match="xsl:template">
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <xsl:attribute name="mode">fiddled</xsl:attribute>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="/" mode="faddle">
+ <xsl:element name="post-transform">
+ <xsl:text>Mode of FOO is </xsl:text>
+ <xsl:value-of select="key('tmpls', 'FOO')/@mode"/>
+ </xsl:element>
+</xsl:template>
+
+<xsl:template name="FOO" mode="input"/>
+
+</xsl:stylesheet>