xsl-list
[Top] [All Lists]

RE: [xsl] encoding error when using cdata

2009-02-23 04:35:25
The error is Microsoft-specific, see for example

http://support.microsoft.com/kb/275883

Incidentally, your code shows inconsistencies in the spelling of
"description" and "longDesc". XML is case-sensitive.

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: Mike Stroud [mailto:stroudmw(_at_)gmail(_dot_)com] 
Sent: 23 February 2009 09:13
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] encoding error when using cdata

Hello all,

I've been experimenting with cdata because I've got some 
funny characters in my XML files. I've got something like this:

<?xml version="1.0" encoding="UTF-8"?>
<wc:COLLECTION xmlns:wc="http://www.ptc.com/infoengine/1.0";>
<ChangedParts NAME="ChangedParts" TYPE="Unknown" STATUS="0"> 
<Part> <Name>446RLi SMD ASSY</Name> 
<description></description> <LongDesc></LongDesc>

etc...

The XSL looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output indent="yes" method="xml" 
cdata-section-elements="Name Description Longdesc"/> 
<xsl:template match="/" xmlns:wc="http://www.ptc.com/infoengine/1.0";>
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>

And the resultant XML turns out like this...

<?xml version="1.0" encoding="UTF-16"?>
<wc:COLLECTION xmlns:wc="http://www.ptc.com/infoengine/1.0";>

etc...

I now get the following error: Switch from current encoding 
to specified encoding not supported. Line: 1. <?xml version="1.0"
encoding="UTF-16"?>

Does anyone know how I can fix this? I've tried different 
encoding methods in the XSL file, but they appear to be ignored.

Thanks,

Mike.

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



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

<Prev in Thread] Current Thread [Next in Thread>