Re: [xslt] [PATCH] Imported encoding not set on result document
- From: Nick Wellnhofer <wellnhofer aevum de>
- To: The Gnome XSLT library mailing-list <xslt gnome org>
- Subject: Re: [xslt] [PATCH] Imported encoding not set on result document
- Date: Mon, 24 Nov 2008 15:36:08 +0100
Roumen Petrov wrote:
What about to add a test case that show that issue is resolved ?
Here is a new patch including a test case. Note that the test only
covers the one symptom of the bug that I noticed.
Nick
--
aevum gmbh
rumfordstr. 4
80469 münchen
germany
tel: +49 89 3838 0653
http://aevum.de/
Index: libxslt/transform.c
===================================================================
--- libxslt/transform.c (revision 1493)
+++ libxslt/transform.c (working copy)
@@ -3217,6 +3217,7 @@
const xmlChar *doctypePublic;
const xmlChar *doctypeSystem;
const xmlChar *version;
+ const xmlChar *encoding;
if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (comp == NULL))
return;
@@ -3506,6 +3507,7 @@
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"))) {
@@ -3565,8 +3567,8 @@
#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);
@@ -5833,6 +5835,7 @@
const xmlChar *doctypePublic;
const xmlChar *doctypeSystem;
const xmlChar *version;
+ const xmlChar *encoding;
xsltStackElemPtr variables;
xsltStackElemPtr vptr;
@@ -5904,6 +5907,7 @@
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")))
@@ -5992,8 +5996,8 @@
#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;
/*
Index: tests/docs/Makefile.am
===================================================================
--- tests/docs/Makefile.am (revision 1493)
+++ tests/docs/Makefile.am (working copy)
@@ -167,6 +167,7 @@
bug-166.xml \
bug-167.xml \
bug-168.xml \
+ bug-169.xml \
character.xml \
array.xml \
items.xml
Index: tests/docs/bug-169.xml
===================================================================
--- tests/docs/bug-169.xml (revision 0)
+++ tests/docs/bug-169.xml (revision 0)
@@ -0,0 +1 @@
+<doc/>
Index: tests/general/bug-169.imp
===================================================================
--- tests/general/bug-169.imp (revision 0)
+++ tests/general/bug-169.imp (revision 0)
@@ -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>
Index: tests/general/Makefile.am
===================================================================
--- tests/general/Makefile.am (revision 1493)
+++ tests/general/Makefile.am (working copy)
@@ -176,6 +176,7 @@
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 \
Index: tests/general/bug-169.xsl
===================================================================
--- tests/general/bug-169.xsl (revision 0)
+++ tests/general/bug-169.xsl (revision 0)
@@ -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>
Index: tests/general/bug-169.out
===================================================================
--- tests/general/bug-169.out (revision 0)
+++ tests/general/bug-169.out (revision 0)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<result attr="Fahrvergnügen"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]