Altova Mailing List Archives
>xsl-list Archive Home
>Thread Prev - RE: [xsl] Recognized Unicode characters?
Re: [xsl] Recognized Unicode characters?
Date: 5/6/2005 9:29:00 AM
> > Shouldn't that be <xsl:output encoding="US-ASCII"... for safety? > > Neither is completely safe of course, ...? cheers andrew If you go <xsl:output encoding="US-ASCII" then your XSLT processor is allowed to reject the stylesheet or ignore the encoding specification if it does not understand this encoding, and it is not obliged to understand the encoding. If it does understand it then it will (in XSLT1, XSLT2 removes this requirement, at least in part for the reasons given here) insert <?xml version="1.0" encoding="US-ASCII"?> at the top of the file. When this resulting XML document is parsed by a subsequent application it may be rejected by the XML parser as a fatal unknown encoding error as XML parsers are not obliged to accept this encoding. I think by now, probably most do, but for example Internet Explorer on Windows 98 (some version or other) (so probably really some version of msxml2) would not accept US-ASCII as a specified encoding, which was a real pain for me at the time as I wanted to use this output encoding from saxon for exactly the reason that you gave, to force non-ascii character to be output as references. In the end I just post-processed wih sed to remove the encoding declaration. Even if all parsers do now in practice support US-ASCII your file is safer long term if the file is ascii encoded but the declaration is not explict so that utf8 encoding is used (which is the same thing in the ascii range) as utf8 support is mandatory. Some bloke sent in an official comment to an early XSLT2 draft on exactly this subject: http://lists.w3.org/Archives/Public/public-qt-comments/2003Nov/0050 and got the reply http://lists.w3.org/Archives/Public/public-qt-comments/2004Sep/0083 David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________