[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

Subject: RE: Display numeric string of the form 01W or 02Y
From: "Surana, Swati " <swati.surana@xxxxxxxx>
Date: Mon, 16 Nov 2009 14:55:59 +0000
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>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.