Altova Mailing List Archives

Re: [xsl] substring

From: "Joris Gillis" <roac@---------->
Date: 2/25/2005 9:00:00 PM
Tempore 21:29:27, die 02/25/2005 AD, hinc in  
xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Bhaskar, Rajan <RBhaskar@xxxxxxx>:

Thanks Joris.

How can i pad an attribute value with (zeros) if the lenght is less that  
a fixed length

suppose i have

<Rx rxNum="1234"> but when transforming it should be 10 digits with left  
padded 000 like

<Rx rxNum="0000001234">

Something like:

<xsl:template match="Rx">
		<xsl:apply-templates select="@*" />

<xsl:template match="@rxNum[string-length() &lt; 10]">

	<xsl:attribute name="rxNum">




<xsl:template match="@rxNum"><xsl:copy-of select="."/></xsl:template>

but sometimes we may just get <Rx rxNum="23"/>
What condition is linked to "sometimes"?

Joris Gillis (
"N&N9N;N.N:N?N?N= N5N9N=N1N9 N<N1N;N;N?N= N7 ON9N;ON;N1N;N?N="  - NN;N5ON2N?ON;N?O


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.