[xsl] Eliminating leading zeros

Subject: [xsl] Eliminating leading zeros
From: "Mark Wilson" <drmark@xxxxxxxxxxxxxxx>
Date: Mon, 21 Aug 2006 07:45:00 -0400
In order to sort item numbers with <xsl:sort> properly and prevent the sorted ouptput order of 1, 10, 100, 2, 3 and so on, I left pad the numbers with leading zeros: 001,002, 003, 010, 100 ....
so that I get 001, 002, 003, 010, 100 ... when I run a ascii sort [other elements are also sorted, so I cannot drop the ascii sort].


I have been trying to figure out how to kill the leading zero after the sort and before printing the output to either an xml or xhtml document. That is, after the sort, when I output the sorted

<item>001</item>
... ... ...
<item>100</item>

I would like it to be rendered as

<sortedItem>1</sortedItem>
... ... ...
<sortedItem>100</sortedItem>

I asume this is a common problem but have not a clue where to look in the archives.Can someone give me a hint?
Thanks,
Mark


Current Thread