[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Original encoding lost after transformation
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|