Hi list,
I seem to have an encoding problem with my xsl transformations. I'm
trying to transform incoming xml data using two stylesheets.
The incoming xml has the ISO-8859-1 encoding. Its declaration is like
this:
<?xml version="1.0" encoding="ISO-8859-1"?>
I then apply two consecutive xsl transformation to it. The problem is
that after the transformations, the output is in the UTF-8 encoding. The
declaration is then like this:
<?xml version="1.0" encoding="UTF-8"?>
Some transformations (depending on the source xml) now fail on the
second pass as the first pass returns data with the wrong UTF-8 declaration
above. The error message is:
java.io.UTFDataFormatException: Invalid byte 2 of 2-byte UTF-8 sequence
This is the stylesheet that does the first transformation (sorting all
nodes):
<?xml version="1.0" encoding="UTF-8">
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()">
<xsl:sort select="name()"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
I tried setting the xsl:output method as this, but to no avail:
<xsl:output method="xml" version="1.0" encoding="ISO-8859-1"/>
What can be wrong? Why is the encoding changed after the transformation?
Any insight greatly appreciated,
Guray
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--