|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Preserving numeric character entity reference
Kjetil Kjernsmo wrote:
I can't use the us-ascii output encoding, as is usually suggested in cases like these, because, the numeric character entity references are actually in the us-ascii range anyway (and we want UTF-8 for the rest). Hi Kjetil, You didn't specify the version of XSLT you are using, but here are a couple of ways that work with XSLT 2: 1. Use xsl:character-map to create literal strings like   for space and A for A, without the XML serializer interfering with it. 2. Use strings like   if obfuscation is all you want, and make sure to translate them back (translating character entities never cascade, i.e., &32; stands for the string " " and not for the entity  , as such you need to do extra translation to go from   back to a space char) 3. Use CDATA sections. But this creates different strings, the same way as with (2). 4. Use string-to-codepoints() to get the codepoints (which map directly to the entities) of the string. I think (2) and (3) will work well with XSLT 1 as well, but both require you to do extra work in your obfuscating tool. If you "just" want to have your text translated to character entities, without the serializer (correctly) making them into readable US-ASCII, option (1) is the easiest and most extensible to do. Cheers, -- Abel Braaksma
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






