Subject: Re: [xsl] Replacing the space character with another character From: "Manfred Staudinger" <manfred.staudinger@xxxxxxxxx> Date: Sun, 13 May 2007 20:26:09 +0200 |
what processor are you using ? If I run your example with Saxon (both 6.5.5 or 8.9.0.3J) I get <indexterm>Greek&History</indexterm>
When I replace translate(.,' ','&') by translate(.,' ','*') I get what you asked for.
Hi,
I'm trying to replace the space character with another character (I've chosen the asterisk, but it could be anything) in a specific element's text contents. I've read the Replace and String Replace pages on Dave Pawson's site, and have read about the translate XPath function, but am still coming up empty (literally!).
In my input XML, I have a number of <indexterm> elements such as the following:
<indexterm>Greek History</indexterm>
I'd like to replace the space character as follows:
<indexterm>Greek*History</indexterm>
My stylesheet contains the following template:
<xsl:template match="indexterm"> <indexterm> <xsl:value-of select="translate(.,' ','&')"/> </indexterm> </xsl:template>
For some reason, the stylesheet removes the spaces, rather than replacing them with the asterisk:
<indexterm>GreekHistory</indexterm>
What am I doing wrong?
Thanks, Mark
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Replacing the space character, Mark Peters | Thread | Re: [xsl] Replacing the space chara, mozer |
[xsl] xsl:function problem, Ilya Sterin | Date | RE: [xsl] various XSD format, Bru, Pierre |
Month |