xsl-list
[Top] [All Lists]

Re: [xsl] format-number troubles

2011-09-20 03:44:47
0501 needs to become 050100

The string padding technique is to have a string of the padding
characters that is the length of the max number of characters you want
to pad to, then get the substring of it using the length of the string
you are padding:

<xsl:variable name="str" select="'0501'"/>
<xsl:value-of select="concat($str, substring('000000',
string-length($str) + 1))"/>

If you think about it, format-number would be no good here, because
you aren't formatting a number, you are changing it from 501 to 50100.

-- 
Andrew Welch
http://andrewjwelch.com

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>