Re: [xsl] Preserving numeric character entity reference

Subject: Re: [xsl] Preserving numeric character entity reference
From: Kjetil Kjernsmo <kjetilk@xxxxxxxxx>
Date: Wed, 14 Feb 2007 16:54:05 +0100
On Wednesday 14 February 2007 12:10, Abel Braaksma wrote:
> You didn't specify the version of XSLT you are using, but here are a
> couple of ways that work with XSLT 2:

Ah, right. And it is even recommendation now... :-) I use libxslt 1.1.17
with mod_xslt, so whatever capabilities they have. I assume that means

> 2. Use strings like &amp;#32; if obfuscation is all you want, and
> make sure to translate them back (translating character entities
> never cascade, i.e., &amp;32; stands for the string "&#32;" and not
> for the entity &#32;, as such you need to do extra translation to go
> from &amp;#32; back to a space char)
>   3. Use CDATA sections. But this creates different strings, the same
> way as with (2).

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

Right. I can do that pretty easily. I allready tried to use CDATA around
the whole HTML string, but that would escape the whole string. And
various combinations of cdata-section-elements and
disable-output-escaping. But I'm not grokking too much.

Then I put a CDATA around just the character entities. And tried the
&amp;, but how would I then go about to translate it back?

Or should I go with a template approach, where I go into the XHTML
fragment and do an value-of with disable output escaping?


Kjetil Kjernsmo
Information Systems Developer
Opera Software ASA

Current Thread