Page 1 of 1

translating function not working!

Posted: Mon Dec 22, 2008 7:04 pm
by hl2gamer
I have an XML document where the user has new line characters denoted like this:
•	


Im trying to use the translate function to get rid of them but it does not work?
i.e translate(@text,'
•	','')

No errors occur when viewing in browser it simply just does not do what it is supposed to do.

Re: translating function not working!

Posted: Tue Dec 23, 2008 4:32 pm
by Dan
Please post a small XML and XSL sample showing the problem.

Trying with:

Code: Select all


<root text="some&#xD;•&#x9;text"/>
and the stylesheet:

Code: Select all


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/root">
<out>
<xsl:value-of select="translate(@text,'&#xD;•&#x9;','&#10;')"/>
</out>
</xsl:template>
</xsl:stylesheet>
I get:

Code: Select all


<?xml version="1.0" encoding="utf-8"?><out>some
text</out>
Which is correct.