[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] translate apos in string


Subject: Re: [xsl] translate apos in string
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 16 Jan 2007 11:21:27 GMT

the faq has several examples showing how to do this.

after it's expanded by the XML parser, 
<xsl:value-of select="
translate(translate(/node,'&#xA;',''),'&apos;', '&apos;')"/>

means that the XSLT engine has to evalate the XPath

translate(translate(/node,'
',''),''', ''')

and ''' is a syntax error.

The intention is to turn "'" into "" (I think) so you want the XPath

translate(translate(/node,'
',''),"'", '')

which you then need to quote using xml entity references in order to put
in an XML attribute

<xsl:value-of
select="translate(translate(/node,'&#xA;',''),&quot;'&quot;, '')"
/>

although you can remove both characters at once with

<xsl:value-of
select="translate(/node,&quot;&#xA;'&quot;,'')"
/>

David


Current Thread
Keywords