Subject: RE: [xsl] Display numeric string of the form 01W or 02Y From: "Surana, Swati " <swati.surana@xxxxxxxx> Date: Mon, 16 Nov 2009 14:55:59 +0000 |
Thanks a ton. -----Original Message----- From: Syd Bauman [mailto:Syd_Bauman@xxxxxxxxx] Sent: 16 November 2009 13:46 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] Display numeric string of the form 01W or 02Y > This isn't working. I am using XSLT1.0 Right, there is no replace() in XPath 1.0 (and thus in XSLT 1.0). Probably the right way to do this in XSLT 1.0 is to use <xsl:number>. But, depending on your data, you might get away with just sticking a '0' in front of anything that is only 2 characters long: <xsl:variable name="formatted_in"> <xsl:choose> <xsl:when test="string-length($in)=2"> <xsl:text>0</xsl:text> <xsl:value-of select="$in"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$in"/> </xsl:otherwise> </xsl:choose> </xsl:variable>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Display numeric string of, Syd Bauman | Thread | [xsl] axis test for namespace nodes, Stefan Krause |
Re: [xsl] Does XSLT contain an easy, Dimitre Novatchev | Date | Re: [xsl] reversing dictionary in x, Martin Honnen |
Month |