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
Post a Comment