[XML-SIG] xsl:comment in 4XSLT
Tamito KAJIYAMA
kajiyama@grad.sccs.chukyo-u.ac.jp
Sun, 26 Nov 2000 14:32:48 +0900
Hi,
I've used 4Suite 0.9.2 with Python 2.0 and PyXML 0.6.2.
I have a problem with 4XSLT. In the content of the xsl:comment
element, a text node yields a string encoded in UTF-8 instead
the encoding specified by <xsl:output encoding="...">.
Following reproduces the problem:
----------------------------------------------------------------------
from xml.xslt.Processor import Processor
STYLESHEET = """\
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="iso-8859-1"/>
<xsl:template match="para">
<para><xsl:value-of select="."/></para>
</xsl:template>
<xsl:template match="note">
<xsl:comment><xsl:value-of select="."/></xsl:comment>
</xsl:template>
</xsl:stylesheet>
"""
XMLDOCUMENT = u"""\
<?xml version="1.0"?>
<doc>
<para>H\344agen-Dazs</para>
<note>H\344agen-Dazs</note>
</doc>
"""
processor = Processor()
processor.appendStylesheetString(STYLESHEET)
result = processor.runString(XMLDOCUMENT.encode("utf-8"))
print repr(result)
----------------------------------------------------------------------
This script gives the following output:
"<?xml version='1.0' encoding='iso-8859-1'?>\012\012<para>H\344agen-Dazs</para>\012<!--H\303\244agen-Dazs-->\012"
where the para element has the correct content, but the comment
does not. Why?
Thanks,
--
KAJIYAMA, Tamito <kajiyama@grad.sccs.chukyo-u.ac.jp>