Altova Mailing List Archives

Re: [xsl] Eliminating leading zeros

From: "Mark Wilson" <drmark@--------------->
Date: 8/21/2006 1:35:00 PM

98% of my problem was solved by your suggestion. Actually, the full senerio 
required some additional statements.

I put in a <xsl:if> test to determine whether the optional element 
<sortedItem> was present or not present (this solved my first set of 
problems), and if it was, I used an <xsl:choose> for <xsl:when> <sortedItem> 
contained only digits (this solved my second set of problems) and 
<xsl:otherwise> when it contained digits together with addition characters, 
as in

<sortedItem>05 (supl.)</sortedItem>

Without the <xsl:otherwise>, a NaN was returned. Thus my third set of 
problems, yet unsolved.

If  <xsl:value-of select="number(.)" /> renders properly when only digits 
are present, what would the code look like to render

<sortedItem> 05 (supl.)</sortedItem>


<renderedItem> 5 (supl.)</renderedItem>

That is, removing the leading zero in this case.

The actual additional text in <sortedItem> may vary, but the digits always 
come first and there is always a space after them. The text is usually,but 
may not always be, (supl.).

Again, thanks for the first bit of help.

----- Original Message ----- 
From: "David Carlisle" <davidc@xxxxxxxxx>

To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>

Sent: Monday, August 21, 2006 7:56 AM

Subject: Re: [xsl] Eliminating leading zeros




These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.