Altova Mailing List Archives


Re: [xsl] Recognized Unicode characters?

From: David Carlisle <davidc@--------->
To:
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
________________________________________________________________________

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.