471,310 Members | 1,073 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

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

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:DrTebi@yahoo.com">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:Dr****@yahoo.com">DrTebi</a>

Now I tried this in the XSL stylesheet:
<a><xsl:attribute
name="href"><![CDATA[mailto:DrTebi@yahoo.com]]></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;&a mp;#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

Jul 20 '05 #1
1 11253
In article <pa***************************@yahoo.com>,
DrTebi <Dr****@yahoo.com> wrote:

[...]

% Now I tried this in the XSL stylesheet:
% <a><xsl:attribute
% name="href"><![CDATA[mailto:DrTebi@yahoo.com]]></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;&a mp;#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)
--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Nimmi Srivastav | last post: by
6 posts views Thread by adnanx82 | last post: by
7 posts views Thread by John Nagle | last post: by
14 posts views Thread by arnuld | last post: by
30 posts views Thread by Medvedev | last post: by
4 posts views Thread by Winks | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.