[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: left zero pad digit string

Subject: RE: left zero pad digit string
From: "Robert C. Lyons" <boblyons@xxxxxxxxxx>
Date: Thu, 31 Aug 2000 13:16:40 -0400
c zero padding
Joel writes:
> Padding a number:
> Requirement: zero pad a digit string 
> Example: 456 --> 000456
> Where the new string length is a passed parameter to the 
> padding template.

Joel,

I believe that format-number( "456", "000000" )
would return "000456". The 2nd arg is the format
pattern.

In your case, the number of zeroes in the format
pattern must be equal to the "new string length."
You can use the substring function to construct
a format pattern with the appropriate number of 
zeroes as follows:

substring( $long_string_of_zeroes, 1, $new_string_length )

Note that I haven't tested any of this.
Hope it helps.

Bob

<sig name    = 'Bob Lyons'
     title   = 'E-Commerce Consultant'
     company = 'Unidex, Inc.'
     phone   = '+1-732-975-9877'
     email   = 'boblyons@xxxxxxxxxx'
     url     = 'http://www.unidex.com/'
     plug    = 'Home of XML Convert'   />


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.