This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: format-number usage on international platform
- To: "Nuri Besen" <nb_news at hotmail dot com>
- Subject: Re: [xsl] format-number usage on international platform
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Fri, 17 Aug 2001 15:53:59 +0100
- CC: xsl-list at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <LAW2-F5149dmmzsiwTw0000d56f@hotmail.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Nuri,
> BUT I know on Xalan 1.2.2 the comma worked correctly in that it
> meant to use the thousands separator of the platform and not literal
> meaning.
The meaning of characters in the format pattern you give as the second
argument to format-number() (e.g. '0', '#', ',', '.') are defined by a
decimal format. If you don't give a third argument for the
format-number() function then it should interpret the format pattern
according to the default decimal format. The default decimal format
defines a ',' (comma) as the grouping separator and a '.' (period) as
the decimal separator.
So whatever platform you're on, whatever internationalisation settings
you've got set, if you do:
format-number(1234, '#,##0')
you should get '1,234'.
If you want to use different separators in a number, then you have to
*both* change the format pattern that you use as the second argument
of format-number() *and* change the decimal format that it uses. For
example, you could define a Turkish decimal format:
<xsl:decimal-format name="Turkish"
grouping-separator="." />
and then call format-number() explicitly referencing that decimal
format:
format-number(1234, '#.##0', 'Turkish')
to get '1.234'.
Alternatively, you could redeclare the default decimal format to use
whatever separators you like:
<xsl:decimal-format grouping-separator="." />
in which case you don't need to use the third argument for
format-number() to get the Turkish formatting.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list