xml - Removing leading 0 in XSLT -


i have ids coming through in xml files padded zeros, such as:

<dog pet_id="00005"> 

when parsing this, i'd integer 5. doing like:

<xsl:value-of select="dog/@pet_id" /> 

retrieves "00005"

what's best way 5?

you can try:

<xsl:value-of select="number(dog/@pet_id)" /> 

or if need convert string:

<xsl:value-of select="string(number(dog/@pet_id))" /> 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -