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

url encoding of ampersands

Subject: url encoding of ampersands
From: Sivan Mozes <sivan@xxxxxxxxxxxxx>
Date: Sun, 25 Feb 2001 00:49:36 -0800 (PST)
url encoding apostrophe
Greetings all. Here's a problem I'm working on:

Description: 
A link is pointing to an anchor, whose name contains an
accented character. The URL is constructed based on a text node in the
XML to avoid using special characters in an attribute. Next, the
stylesheet needs to replace all ampersands with %26 for URL
encoding. 

Example:

XML:
<link type="anchor">Cr&#233;pe</link>

Expected result:
<a href="#Cr%26#233;pe">Cr&#233;pe</a>

Template:
<xsl:template match="link">
  <xsl:variable name="anchor" select="concat(substring-before( . ,
'&amp;'), '%26', substring-after( . , '#'))"/>

...

</xsl:template>

Actual result:  
I am unable to match on the ampersands using contains() or
substring functions, but can see them in the result tree, as the entity
has transformed into &eacute;. 

I tried various combinations of CDATA, disable-output-escaping, and
others which I can't describe clearly here. translate() can see the
ampersands, but I can't think of a way of using it here.

Help will be greatly appreciated.

Sivan


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.