[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: format-number usage on international platform

Subject: Re: format-number usage on international platform
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Fri, 17 Aug 2001 15:53:59 +0100
decimal format comma
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.