Re: [xsl] Trouble transforming special characters

Subject: Re: [xsl] Trouble transforming special characters
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Tue, 10 Aug 2010 18:12:38 +0200
Craig Whisenhunt wrote:

Is there a way for me to do this without character maps such that I
don't have to change the XSL processor? I may not be in a position to
switch to Saxon 9.

If you choose an output encoding UTF-8 then the XSLT processor has no reason to escape any Unicode character with a character reference or entity reference. If, as Andrew suggested, you choose output encoding US-ASCII then I think XslCompiledTransform will output any non ASCII characters as numeric character references so you would get &#xF1; (& # x F 1; in case this gets mangled) in the result document for the tilde. I don't think there is a way to enforce outputting an entity reference with pure XSLT 1.0, for that you need a character map and XSLT 2.0.
There is however an extension to XslCompiledTransform in http://mvpxml.codeplex.com/wikipage?title=Common&referringTitle=Home, it has a CharacterMappingXmlWriter which tries to provide such a feature as a serialization option with .NET and XslCompiledTransform.


--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

Current Thread