DanteTw
DanteTw

Reputation: 60

XSLT function format-number not showing zeroes

I have xml like this:

<test>1.3122000000031211</test>

With xslt:

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

I'm getting result 1.3122. Is it possible to get 1.3122000000? When I have value like this 1.31225642115696 I'm getting 1.3122564211 which is good.

Upvotes: 2

Views: 583

Answers (2)

hek2mgl
hek2mgl

Reputation: 158040

You need to use 0 instead of #:

<xsl:value-of select="format-number(test, '0.0000000000')" />

You can refer to the offical documentation: http://www.w3.org/TR/xslt#function-format-number

Upvotes: 2

Martin Honnen
Martin Honnen

Reputation: 167571

If you use a zero 0 instead of # then even non significant zeroes will be output: format-number(test, '0.00000000000')".

Upvotes: 2

Related Questions