[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: &

Subject: Re: &
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 21 Mar 2007 12:33:22 +0100
Re:  &amp;amp;
Marco wrote:

<A onmouseout="cs()" href="{./@url}"><xsl:attribute name="onmouseover"><xsl:text>return ss('visit </xsl:text><xsl:value-of select="./@visible_url" disable-output-escaping="yes" /><xsl:text>')</xsl:text></xsl:attribute>TITLE</A><br />
<font size="-1"><span class="test">BODY</span><br />
<a HREF="{./@url}"><font size="-1"><xsl:value-of select="./@visible_url" disable-output-escaping="yes"/></font></a>
</font>



the problem is the onmouseover attribute where I get:


url2?escape&amp;amp;chars and in my page I see url2?escape&amp;chars


You are making it much harder than you need to. Do not use onmouseover just to display a text, use the attribute 'title', which works on all modern browsers and does the escaping automatically.


Further, you are mixing your problem a bit, it is not XSLT, but js scripting that contains your problem. You show us your HTML (one advice: please use only lower-case for attribute and element names in HTML, that way you are prepared for XHTML) from within XSLT, but what we need is the output from the processor.

The problem is not in your disable-output-escaping, but in the way that browser escape, render and display your data. What is inside the <a>...</a> is automatically resolved, hence any &amp; will become &. But what's in your javascript depends on how you deal with it. I'm not sure of the JS function, but I guess you want something like value.unescape(). But then again, this can likely be achieved with a simple title attribute.

Furthermore, if you do stick to the onmouseover with a javascript call, using the same text as already in the a-href element, use the popular (but often discouraged) syntax of your_function(this), which gives you all control you need. You will see that if you use, in your script, obj.href or obj.firstChild.value that you will still see the unescaped value of your @visible url.

Last but not least: you do not need to prefix your XPath expressions with ' ./ ', you can safely remove that. But of course, that's all a matter of taste.

Cheers,
-- Abel Braaksma
  http://www.nuntia.nl

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.