Re: [xsl] Re: encoding error when using cdata

Subject: Re: [xsl] Re: encoding error when using cdata
From: "Nick Fitzsimons" <nick@xxxxxxxxxxxxxx>
Date: Wed, 25 Feb 2009 10:55:37 -0000 (GMT)

One point worthy of note is that you aren't specifying your output
encoding in the <xsl:output /> element. Although you have specified
Windows-1252 encoding in the XML declaration, this refers to the encoding
of the stylesheet itself, not its output. I believe that modifying your
output element thus:

    cdata-section-elements="Name LongDesc"

will be necessary if your input document is UTF-8.

Also, you might want to look at a reply I sent to the list a few years back:



On Tue, February 24, 2009 6:22 am, Mike Stroud wrote:
> Many thanks for your reply. What I don't understand is why the
> resultant XML file is encoded like this: <?xml version="1.0"
> encoding="UTF-16"?>. I can't seem to change it! What I want is
> WINDOWS-1252, but I end up with UTF-16 no matter what I do (The source
> XML document is UTF-8). My XSL looks like this:
> <?xml version="1.0" encoding="Windows-1252"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="";>
> <xsl:output indent="yes" method="xml" cdata-section-elements="Name
> LongDesc"/>
> <xsl:template match="/" xmlns:wc="";>
> <xsl:copy-of select="."/>
> </xsl:template>
> </xsl:stylesheet>

Nick Fitzsimons

Current Thread