This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

url encoding of ampersands


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]