[libxslt] Fix importing of encoding from included stylesheets
- From: Daniel Veillard <veillard src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libxslt] Fix importing of encoding from included stylesheets
- Date: Thu, 17 Sep 2009 08:59:08 +0000 (UTC)
commit 4fedd0dc16bfa394e7dd0b2a44e21256ce3b4021
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Thu Sep 17 10:57:22 2009 +0200
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
libxslt/transform.c | 12 ++++++++----
tests/docs/Makefile.am | 1 +
tests/docs/bug-169.xml | 1 +
tests/general/Makefile.am | 1 +
tests/general/bug-169.imp | 5 +++++
tests/general/bug-169.out | 2 ++
tests/general/bug-169.xsl | 11 +++++++++++
7 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/libxslt/transform.c b/libxslt/transform.c
index 3466469..ce0bf43 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 b10edca..4393739 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 0000000..69d62f2
--- /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 87b0ed2..5d5baf0 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 0000000..2928f4b
--- /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 0000000..30f8fad
--- /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 0000000..e34ad9e
--- /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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]