This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Add n number of characters to Element text


I am working with Java and Xerces.

I need to add n number of characters, the "0" character specifically, to 
the text of a particular element depending on the length of the element's text.

VB had a function for this called String(char, n).
Called like this, String("0", 2) would return "00"
I am not sure what the Java analog is.

For this particular case, the text must be only two characters.

For Example:
   <FOO>1</FOO> ===>>> <FOO>01</FOO>
   <FOO>2</FOO> ===>>> <FOO>02</FOO>
   <FOO>10</FOO> ===>>> <FOO>10</FOO>

Could I do something like this
<xsl:template match="FOO">
   string("0", 2-length(<xsl:value-of select="."/>))<xsl:value-of select="."/>
</xsl:template>

Ross Cormier
Structure Consulting Group L.L.C
225-772-4973


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]