[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Original encoding lost after transformation

Subject: Original encoding lost after transformation
From: guray@xxxxxxxxxxxxxxxxxxxx
Date: Fri, 18 Feb 2005 12:02:38 +0100
encoding lost
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.