Subject: RE: Display numeric string of the form 01W or 02Y
From: Syd Bauman <Syd_Bauman@xxxxxxxxx>
Date: Mon, 16 Nov 2009 08:45:33 -0500
|
> 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>
|