how can I display "&#34" etc. after xml-xsl transformation?

D

DrTebi

Hello,
I have the following problem:
I used to "encode" my email address within links, in order to avoid (most)
email spiders. So I had a link like this:
<a
href="mailto:D[email protected]">DrTebi</a>

This would work like a regular mailto link in any browser, but wouldn't be
visible to spiders if they don't have a function to decode it.

The problem is if I use this in an XSL stylesheet, it gets converted to my
email address:
<a href="mailto:D[email protected]">DrTebi</a>

Now I tried this in the XSL stylesheet:
<a><xsl:attribute
name="href"><![CDATA[mailto:D[email protected]]]></xsl:attribute>DrTebi</a>

But that resulted in
<a
href="mailto:&amp;#68;&amp;#114;&amp;#84;&amp;#101;&amp;#98;&amp;#105;&amp;#64;&amp;#121;&amp;#97;&amp;#104;&amp;#111;&amp;#111;&amp;#46;&amp;#99;&amp;#111;&amp;#109;">DrTebi</a>

--which does not work in a browser as a link.

Can anyone please point me to the right direction?

Thanks,
DrTebi

P.S.: I am using PHP5 for XML/XSL transformations, which is based on
libxml2
 
P

Patrick TJ McPhee

[...]

% Now I tried this in the XSL stylesheet:
% <a><xsl:attribute
% name="href"><![CDATA[mailto:D[email protected]]]></xsl:attribute>DrTebi</a>
%
% But that resulted in
% <a
% href="mailto:&amp;#68;&amp;#114;&amp;#84;&amp;#101;&amp;#98;&amp;#105;&amp;#64;&amp;#121;&amp;#97;&amp;#104;&amp;#111;&amp;#111;&amp;#46;&amp;#99;&amp;#111;&amp;#109;">DrTebi</a>

Try
<a><xsl:attribute name="href">
<xsl:text>mailto:</xsl:text>
<xsl:text disable-output-escaping='yes'><![CDATA[Dr]]></xsl:text>
<xsl:text disable-output-escaping='yes'><![CDATA[Te]]></xsl:text>
<xsl:text disable-output-escaping='yes'><![CDATA[bi]]></xsl:text>
<xsl:text disable-output-escaping='yes'><![CDATA[@y]]></xsl:text>
<xsl:text disable-output-escaping='yes'><![CDATA[ah]]></xsl:text>
<xsl:text disable-output-escaping='yes'><![CDATA[oo]]></xsl:text>
<xsl:text disable-output-escaping='yes'><![CDATA[.c]]></xsl:text>
<xsl:text disable-output-escaping='yes'><![CDATA[om]]></xsl:text>
</xsl:attribute></a>

(that is, try disable-output-escaping -- I've just put several of them
there to keep the line lenghts shorter)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top