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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

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:


The Network for Technology Professionals

Search:

About Internet.com

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

webref The latest from WebReference.com Browse >
Search Engine Optimization: Selecting and Embedding Keywords · Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
IBM DB2 10 for z/OS: Justifying the Upgrade · Living La Vida Colo: Choosing the Right Colocation Facility · FTC Concerns over Social Media Privacy Linger