Dizeme
Dizeme

Reputation: 57

XSL decimal formatting

I am trying to pass a xsl:value-of to the format-number function instead of a hardcoded number but I cannot get it to work. Is this even possible? If so could someone point me to the right direction?

<Value>
   <xsl:value-of select='format-number(<xsl:value-of select="number"/>, "#.00")'/>
</Value> 

Upvotes: 0

Views: 222

Answers (1)

hr_117
hr_117

Reputation: 9627

The first parameter of format-number can be an xpath expression. Therefore try:

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

Upvotes: 1

Related Questions