[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
G. Ken Holman wrote:
--
Re: [xsl] Replace(//text()) in XSLT 1
Subject: Re: [xsl] Replace(//text()) in XSLT 1 From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Fri, 16 Nov 2012 18:14:53 +0100 |
G. Ken Holman wrote:
At 2012-11-16 12:01 -0500, Nathan Tallman wrote:I'd like to replace hyphens with en dashes. In XSLT 2.0, I can do this with replace(text()), but I'm limited to XSLT 1.0.
How could I achieve the same thing in XSLT 1.0?
<xsl:value-of select="replace(//text(), '-', '–')"/>
First of all, I would expect the above statement to fail because the first argument to replace has to be a singleton. I would have used:
<xsl:value-of select="replace(.,'-','–')"/>
As for an XSLT 1.0 version, you need a recursive call to walk through the string making one replacement at a time
Why does <xsl:value-of select="translate(., '-', '–')"/> not suffice?
--
Martin Honnen --- MVP Data Platform Development http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Replace(//text()) in XSLT, G. Ken Holman | Thread | Re: [xsl] Replace(//text()) in XSLT, G. Ken Holman |
Re: [xsl] Replace(//text()) in XSLT, G. Ken Holman | Date | Re: [xsl] Replace(//text()) in XSLT, G. Ken Holman |
Month |
Keywords