Re: [xsl] Eliminating leading zeros

Subject: Re: [xsl] Eliminating leading zeros
From: Florent Georges <darkman_spam@xxxxxxxx>
Date: Mon, 21 Aug 2006 15:50:40 +0200 (CEST)
Mark Wilson wrote:

> 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>
> as
> <renderedItem> 5 (supl.)</renderedItem>
> That is, removing the leading zero in this case.

  So maybe my first response wasn't so stupid :-).  You can use a
choose where you test if the string starts with " 00" or " 0".

  If you don't know how many leading zeros there may be (but I guess
you know, because you add them yourself), you can use substrings to get
the first token surrounded by withespaces, then try number() on that,
and concatenate the string with the number (or keep the original string
if NaN).



 uncompressed/chunked Mon Aug 21 13:13:44 GMT 2006 
Dicouvrez un nouveau moyen de poser toutes vos questions quelque soit le sujet ! 
Yahoo! Questions/Riponses pour partager vos connaissances, vos opinions et vos expiriences. 

Current Thread