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

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -