Closed
Bug 155734
Opened 23 years ago
Closed 23 years ago
support '##.' in format-number() function
Categories
(Core :: XSLT, enhancement)
Core
XSLT
Tracking
()
VERIFIED
FIXED
People
(Reporter: david, Assigned: sicking)
References
()
Details
(Keywords: compat, Whiteboard: TX_BRIDGE_1_1_FIXED)
Attachments
(2 files, 1 obsolete file)
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.1a+) Gecko/20020702
BuildID: 2002070204
XSLT format-number() http://www.w3.org/TR/xslt#format-number
The XSLT spec requires that the formatting pattern has at least one '0' before
the decimal-point, e.g. '#0.' not '##.'
However, many processors seems to accept the '##.' pattern, and it has been
expected by the reporter and others.
Might it be a good idea for us to support it?
Reproducible: Always
Steps to Reproduce:
Try attached testcase.
Actual Results:
Unformatted from XML: 37425.6770833333
Format from XML as "##.": invalid parameter value for function:
format-number(number,'##.')
Format from XML as "##.##": invalid parameter value for function:
format-number(number,'##.##')
Format 191.252 as "##.": invalid parameter value for function:
format-number(191.252,'##.')
Format 191.252 as "##.##": invalid parameter value for function:
format-number(191.252,'##.##')
Expected Results:
Unformatted from XML: 37425.6770833333
Format from XML as "##.": 37426
Format from XML as "##.##": 37425.68
Format 191.252 as "##.": 191
Format 191.252 as "##.##": 191.25
| Reporter | ||
Comment 1•23 years ago
|
||
| Reporter | ||
Comment 2•23 years ago
|
||
Attachment #90189 -
Attachment is obsolete: true
| Reporter | ||
Comment 3•23 years ago
|
||
Updated•23 years ago
|
| Reporter | ||
Comment 4•23 years ago
|
||
Sorry, just realised that I put the wrong expected/actual results in. They don't
match the testcase, but they do give an idea.
I'll have to apply for more priveleges so I can correct it...
Comment 5•23 years ago
|
||
David, IMHO the testcase is fine as is, don't bother.
Nicely filed report, thanx. Give me another one of those, and I'll boost your
privs.
| Assignee | ||
Comment 6•23 years ago
|
||
ok guys, waddaya think, do we want to support this? I tend to lean towards yes
so that gets half a vote from me
Comment 7•23 years ago
|
||
two wrongs don't make no right, but two half votes get you a bug ;-)
I'll assign that to Jonas, he knows what he did, hopefully. I tried to remember
how that code works, and failed.
Assignee: peterv → sicking
| Reporter | ||
Comment 8•23 years ago
|
||
Jonas, excuse me for being dense, but where in the spec does it require '0'?
(Re:
http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&frame=right&th=3e5bb244ea8f4d5a&seekm=ag0vfo%24oti4%40ripley.netscape.com#link6)
Also, I'm not sure on how the decision gets made for adding this sort of thing,
when does adding something for compatiblity become extending the spec?
Is it a case of making sure that you do what the spec wants, and then you can
add other features as you please (suitably separated from the spec stuff)?
Comment 9•23 years ago
|
||
so, once again, the link to the spec.
... and the grammar goes
integer := '#'* '0'* '0'
hey, ho, hey, ho.
see, one 0 is required.
I understand Jonas' as well as my comments as "yes, we should support that",
and the "compat" keyword says so, too. Not to mention that I confirmed the bug
instead of WONTFIXing it.
| Assignee | ||
Comment 10•23 years ago
|
||
http://www.w3.org/TR/xslt#format-number says:
"The format pattern string is in the syntax specified by the JDK 1.1
DecimalFormat class"
with a link to:
http://java.sun.com/products/jdk/1.1/docs/api/java.text.DecimalFormat.html
which defines
subpattern := {prefix}integer{.fraction}{suffix}
integer := '#'* '0'* '0'
So the integer part must always end with a '0'.
The reason that i'm even considering adding this however is that Suns
javaimplementation (and all other ones i would guess) accepts patterns like '##.'
Status: NEW → ASSIGNED
Comment 11•23 years ago
|
||
note related bug 156594. If the format-number() function is fixed to support
"##.", might as well fix the rounding error at the same time.
Jake
| Assignee | ||
Comment 12•23 years ago
|
||
the patch in bug 156594 fixes this too
| Assignee | ||
Updated•23 years ago
|
Whiteboard: TX_BRIDGE_1_1_FIXED
| Assignee | ||
Comment 13•23 years ago
|
||
fixed with the branchlanding
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 14•23 years ago
|
||
we didn't verify for a long time.
I really checked, so VERIFIED.
Status: RESOLVED → VERIFIED
Comment 15•23 years ago
|
||
*** Bug 163657 has been marked as a duplicate of this bug. ***
You need to log in
before you can comment on or make changes to this bug.
Description
•