translating function not working!

Here should go questions about transforming XML with XSLT and FOP.
hl2gamer
Posts: 1
Joined: Mon Dec 22, 2008 6:58 pm

translating function not working!

Post 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.
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: translating function not working!

Post 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.
Post Reply