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

Re: &

Subject: Re: &
From: Marco <spinmar@xxxxxxxxx>
Date: Wed, 21 Mar 2007 12:53:17 +0100
Re:  &amp;amp;
David Carlisle ha scritto:
I have a xml document with:

......
<NODE n="1" url="url1" visible_url="url2?escape&amp;amp;chars"></NODE>
..

this is almost certainly a mistake in the input and if you have control
over the generation of these files, you should fix the generator to
produce
<NODE n="1" url="url1" visible_url="url2?escape&amp;chars"></NODE>
The problem is that I don't produce the xml but I receive it from an external source.
and it's ok;
the problem is the onmouseover attribute where I get:

disable-output-escaping is defined to do nothing in attribute values. It's almost always a bad idea to use d-o-e in any case.



you need to replace &amp; by &, in XSLT2, you could use

select="replace(@visible_url,'&amp;amp;',' &amp;')"

in XSLT1 you could use one of the many replace templates posted to this
list, or the faq to do the same transformation.
For example I can use this one:

<xsl:template name="replaceUrl">
<xsl:param name="url" />
<xsl:choose>
<xsl:when test="contains($url, '&amp;amp;')">
<xsl:value-of select="concat(substring-before($url, '&amp;amp;'), '&amp;')" disable-output-escaping="yes" />
<xsl:call-template name="replacee">
<xsl:with-param name="url"><xsl:value-of select="substring-after($url, '&amp;amp;')" disable-output-escaping="yes"/></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$url" disable-output-escaping="yes" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>


For Abel:

my javascript function (ss) on onmouseover shows the url in the status bar of browser and I have to use it.
So I'd like to find a method to solve my problem in XSL 1.0.


Best regards

David

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.