简体   繁体   中英

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.

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

如果您使用零0而不是#那么即使是不重要的零也将输出: format-number(test, '0.00000000000')"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM