xsl-list
[Top] [All Lists]

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

2009-02-25 05:56:04
Hi,

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:

<xsl:output
    indent="yes"
    method="xml"
    cdata-section-elements="Name LongDesc"
    encoding="Windows-1252"
/>

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:
<http://www.biglist.com/lists/xsl-list/archives/200710/msg00105.html>

HTH,

Nick.

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="http://www.w3.org/1999/XSL/Transform";>
<xsl:output indent="yes" method="xml" cdata-section-elements="Name
LongDesc"/>
<xsl:template match="/" xmlns:wc="http://www.ptc.com/infoengine/1.0";>
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>


-- 
Nick Fitzsimons
http://www.nickfitz.co.uk/



--~------------------------------------------------------------------
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>
--~--