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

Re: Eliminating leading zeros

Subject: Re: Eliminating leading zeros
From: "andrew welch" <andrew.j.welch@xxxxxxxxx>
Date: Mon, 21 Aug 2006 15:21:12 +0100
padding leading zeroes
On 8/21/06, Mark Wilson <drmark@xxxxxxxxxxxxxxx> wrote:

Yes I am using XSLT2 (albeit very poorly understood). Will try your suggestion.

Padding leading zero's to sort and then removing them seems like a bad idea when you can just sort twice, once using data-type number and then again using text, extracting the relevant part of the value each time, eg:

<xsl:sort select="replace(., '\s\D*', '')" data-type="number"/>
<xsl:sort select="replace(., '\d*\s', '')" data-type="text"/>

Otherwise you will need to pick a suitably large number of zeros to
pad and hope a longer number never appears, or find the maximum length
for all the numbers up front...

cheers
andrew

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-2011 All Rights Reserved.