Project

Profile

Help

Support #3540

closed

Bug XPath format-number function

Added by Eduard Belov about 7 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Diagnostics
Sprint/Milestone:
Start date:
2017-11-22
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
9.8
Fix Committed on Branch:
9.8
Fixed in Maintenance Release:
Platforms:

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.

Actions #1

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.

Actions #2

Updated by Eduard Belov about 7 years ago

Thanks for the answer.

Prompt the best solution.

I need:

  1. 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

Actions #3

Updated by Eduard Belov about 7 years ago

Thanks, I figured it out.

Solution

format-number(123456, '### ##0,##', 'formatNumber')

Actions #4

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

Also available in: Atom PDF