By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,435 Members | 2,033 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,435 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.