summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2009-09-17 10:57:22 +0200
committerDaniel Veillard <veillard@redhat.com>2009-09-17 10:57:22 +0200
commit4fedd0dc16bfa394e7dd0b2a44e21256ce3b4021 (patch)
tree449c36c5872390c8135c1365b715e83aecb2e882
parentab09910837fc0f2296498bdd76e0fc05c280979d (diff)
downloadlibxslt-4fedd0dc16bfa394e7dd0b2a44e21256ce3b4021.tar.gz
Fix importing of encoding from included stylesheets
* libxslt/transform.c: process encoding like other imported output properties * tests/docs/Makefile.am tests/docs/bug-169.xml tests/general/Makefile.am tests/general/bug-169.*: add a specific regression test
-rw-r--r--libxslt/transform.c12
-rw-r--r--tests/docs/Makefile.am1
-rw-r--r--tests/docs/bug-169.xml1
-rw-r--r--tests/general/Makefile.am1
-rw-r--r--tests/general/bug-169.imp5
-rw-r--r--tests/general/bug-169.out2
-rw-r--r--tests/general/bug-169.xsl11
7 files changed, 29 insertions, 4 deletions
diff --git a/libxslt/transform.c b/libxslt/transform.c
index 3466469c..ce0bf434 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -3220,6 +3220,7 @@ xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node,
const xmlChar *doctypePublic;
const xmlChar *doctypeSystem;
const xmlChar *version;
+ const xmlChar *encoding;
if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (comp == NULL))
return;
@@ -3509,6 +3510,7 @@ xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node,
XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic)
XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem)
XSLT_GET_IMPORT_PTR(version, style, version)
+ XSLT_GET_IMPORT_PTR(encoding, style, encoding)
if ((method != NULL) &&
(!xmlStrEqual(method, (const xmlChar *) "xml"))) {
@@ -3568,8 +3570,8 @@ xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node,
#endif
}
res->charset = XML_CHAR_ENCODING_UTF8;
- if (style->encoding != NULL)
- res->encoding = xmlStrdup(style->encoding);
+ if (encoding != NULL)
+ res->encoding = xmlStrdup(encoding);
ctxt->output = res;
ctxt->insert = (xmlNodePtr) res;
xsltApplySequenceConstructor(ctxt, node, inst->children, NULL);
@@ -5836,6 +5838,7 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
const xmlChar *doctypePublic;
const xmlChar *doctypeSystem;
const xmlChar *version;
+ const xmlChar *encoding;
xsltStackElemPtr variables;
xsltStackElemPtr vptr;
@@ -5909,6 +5912,7 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic)
XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem)
XSLT_GET_IMPORT_PTR(version, style, version)
+ XSLT_GET_IMPORT_PTR(encoding, style, encoding)
if ((method != NULL) &&
(!xmlStrEqual(method, (const xmlChar *) "xml")))
@@ -5997,8 +6001,8 @@ xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc,
#endif
}
res->charset = XML_CHAR_ENCODING_UTF8;
- if (style->encoding != NULL)
- res->encoding = xmlStrdup(style->encoding);
+ if (encoding != NULL)
+ res->encoding = xmlStrdup(encoding);
variables = style->variables;
/*
diff --git a/tests/docs/Makefile.am b/tests/docs/Makefile.am
index b10edcab..43937399 100644
--- a/tests/docs/Makefile.am
+++ b/tests/docs/Makefile.am
@@ -167,6 +167,7 @@ EXTRA_DIST = \
bug-166.xml \
bug-167.xml \
bug-168.xml \
+ bug-169.xml \
character.xml \
array.xml \
items.xml
diff --git a/tests/docs/bug-169.xml b/tests/docs/bug-169.xml
new file mode 100644
index 00000000..69d62f2c
--- /dev/null
+++ b/tests/docs/bug-169.xml
@@ -0,0 +1 @@
+<doc/>
diff --git a/tests/general/Makefile.am b/tests/general/Makefile.am
index 87b0ed2c..5d5baf09 100644
--- a/tests/general/Makefile.am
+++ b/tests/general/Makefile.am
@@ -176,6 +176,7 @@ EXTRA_DIST = \
bug-166.out bug-166.xsl \
bug-167.out bug-167.xsl \
bug-168.out bug-168.xsl \
+ bug-169.out bug-169.xsl bug-169.imp \
character.out character.xsl \
character2.out character2.xsl \
itemschoose.out itemschoose.xsl \
diff --git a/tests/general/bug-169.imp b/tests/general/bug-169.imp
new file mode 100644
index 00000000..2928f4b7
--- /dev/null
+++ b/tests/general/bug-169.imp
@@ -0,0 +1,5 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<xsl:output encoding="iso-8859-1"/>
+
+</xsl:stylesheet>
diff --git a/tests/general/bug-169.out b/tests/general/bug-169.out
new file mode 100644
index 00000000..30f8fad9
--- /dev/null
+++ b/tests/general/bug-169.out
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<result attr="Fahrvergnügen"/>
diff --git a/tests/general/bug-169.xsl b/tests/general/bug-169.xsl
new file mode 100644
index 00000000..e34ad9e7
--- /dev/null
+++ b/tests/general/bug-169.xsl
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<xsl:import href="bug-169.imp"/>
+
+<xsl:template match="/">
+ <result attr="Fahrvergnügen"/>
+</xsl:template>
+
+</xsl:stylesheet>