stockoverflow
stockoverflow

Reputation: 1457

Using XSLT to make XML (e.g.<price>10000</price>) display as 10,000?

A simple problem that I was wondering if it could be done.

Upvotes: 1

Views: 106

Answers (2)

Andrey Adamovich
Andrey Adamovich

Reputation: 20663

Try using xsl:decimal-format element and format-number() function.

Upvotes: 3

Jan Thomä
Jan Thomä

Reputation: 13622

You can do this with the format-number function:

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

See http://www.w3schools.com/XSL/func_formatnumber.asp for a complete reference.

Upvotes: 1

Related Questions