user2132234
user2132234

Reputation: 301

Hide first "Zero" on a number value with xml

i'v got a problem... I Need to show some prices in my website from database. I'm using this function to show them:

<xsl:value-of select="entry/name"/>

My problem is this: due to "sorting reasons" I need to enter values like this: 0800 (for 800 dollars). Are there an xml filter/function which can remove the first number if it is a "0" (zero)? Thank you very much

Upvotes: 2

Views: 246

Answers (1)

ghord
ghord

Reputation: 13797

If your name contains only decimal digits, just do

<xsl:value-of select='format-number(entry/name, "#")'/>

It will strip any zeroes from the start of a number.

Upvotes: 1

Related Questions