xsl-list
[Top] [All Lists]

Re: [xsl] Eliminating leading zeros

2006-08-21 07:21:38
On 8/21/06, Mark Wilson <drmark(_at_)tlcdelivers(_dot_)com> 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--