spacer
Yehuda Shiran January 4, 2002
Specifying the Number Formatting Scheme in XSLT
Tips: January 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

The XSLT file supports formatting of numerical XML data. You use the following method:

format-number(@dvds_rented, "###,###");
The peculiar behavior of the browser is that it picks up the number of "#" signs to the right of the comma as the determining distance between commas in the formatted data. The example above dictates that the first comma will be placed to the left of the third right most digit, then to the left of the sixth right most digit, etc. The number 19761247, for example, will be formatted as 19,761,247. Similarly, the following line of XSL code:

format-number(@dvds_rented, "####,##");
will put a comma every two digits. For the above example, you'll get 19,76,12,47.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business