Support #3540
closedBug XPath format-number function
0%
Description
Good morning.
I'm using the version 9.8.0.4 library.
<xsl:decimal-format name="formatNumber" decimal-separator="," grouping-separator=" "/>
<xsl:value-of select="format-number(55, '### ###,##', 'formatNumber')"/>
Return '55,0' value.
I think it should be '55'?
Thanks for the answer.
Updated by Michael Kay about 7 years ago
Note that the same happens when you use default decimal-format characters:
format-number(55, '###,###.##')
returns
"55.0"
At first sight, this is a consequence of the rule in 4.7.4:
If (after making the above adjustments) the minimum-integer-part-size and the minimum-fractional-part-size are both zero, then the minimum-fractional-part-size is set to 1 (one).
Basically, you either need a digit before the decimal point or a digit after it, and the spec has decided that if you don't ask for either, then you get one after the decimal point.
Updated by Eduard Belov about 7 years ago
Thanks for the answer.
Prompt the best solution.
I need:
- format-number(123456.123, '### ###,##', 'formatNumber') return "123 456,12" It is perfectly
2)format-number(123456, '### ###,##', 'formatNumber') return "123 456,0" Problem, I would like to see "123 456"
If you pay attention
https://msdn.microsoft.com/en-us/library/ms256225(v=vs.120).aspx
The following function call returns 5,351
format-number(5351,"#,###")
Thanks for the help
Updated by Eduard Belov about 7 years ago
Thanks, I figured it out.
Solution
format-number(123456, '### ##0,##', 'formatNumber')
Updated by Michael Kay about 7 years ago
- Tracker changed from Bug to Support
- Status changed from New to Closed
Please register to edit this issue