[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] generating numerical character entities in html output


Subject: [xsl] generating numerical character entities in html output
From: Rossella Rosin <tanataviele@xxxxxxxxxxx>
Date: Tue, 18 Jan 2005 11:11:35 +0100

First of all, please forgive me if I'm asking a frequent question - I'm new to the list and I've searched the archive and seen there's a lot of talking about entities... so much in effect that after viewing a certain number of threads, trying some of the solutions I've found, but not solving my problem (I got actually a bit confused) and not having much time at my disposal I've decided to write hoping you can be patient enough to repeat yourselves ;-)

What I would like to do is the following:
I'm using xslt to create xhtml and/or html4 pages and wish to create an importable xslt stylesheet (so xsl 1.0 if possible) that allows me to hide e-mail addresses from spammers.
That is if I have, say,


<nospam>me@xxxxxxxxxx</nospam>

in the xml source, I want my xslt code to produce something like

&#109;&#101;&#64;&#109;&#121;&#115;&#101;&#108;&#102;&#46;&#101;&#120;&#116;

in the generated html source.
Actually I want to do something even more complicated than that, like inserting spaces, invisible images or dummy text, but let's forget about that for now.


As you have already guessed I've had a hell of a lot of problems in trying to generate such stuff, and I've fought for hours with <xsl:text />, CDATA and the disable-output-escaping attribute without getting anywhere.

I'm particularly puzzled by the fact that

<xsl:text disable-output-escaping="yes">&amp;</xsl:text>

correctly generates "&amp;" in the html code but

<xsl:text disable-output-escaping="yes">&#64;</xsl:text>

always generates "@", independently of the value of disable-output-escaping. Use of CDATA within xsl:text just causes the generated code to be &amp;#64;.
Setting the output to text of course fixes the problem, but as I told you I want to do something even more complicated than that, which involves generating tags, so I cannot use it (can I?).


I'm not a standards expert, but I'm pretty sure numerical character entities ar at home in an html file so it *should* be possible to generate such a code with XSLT.
Is there no hope?


Thanks for any clue,

Rossella


Current Thread
Keywords