[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Display numeric string of the form 01W or 02Y
Thanks a ton. -----Original Message----- From: Syd Bauman [mailto:Syd_Bauman@xxxxxxxxx] Sent: 16 November 2009 13:46 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: 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>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|