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

Re: formatting numbers and dates

Subject: Re: formatting numbers and dates
From: David_Marston@xxxxxxxxx
Date: Tue, 28 Dec 1999 15:25:48 -0500
formatting numbers in concatenate
 >I'm brand new to XSL so forgive my ignorance, but I'm trying to use
>format-number() and can't seem to figure out the proper syntax.

If you're having problems with the function, the first step is to get
an up-to-date XSL processor. Only recently-issued ones, like Xalan
0.19.1 from Apache, have this function working well.

>Could someone show me how to convert the results of something
>simple like <xsl:value-of select="cost"/> so that it displays
>as currency, like $12.00.

format-number(cost,'###0.00') causes cost to be formatted with 1-4
places before the decimal point, and 2 places after. The # signals
zero suppression, while the 0 signals display of any digit. The spec
says (section 12.3, first paragraph) that the currency sign 0x00A4
must not be in the pattern string, but you could concatenate it in
front.

>Is there a similar function for converting a date the is in
>yyyymmdd format?

There is no function that is specifically aware of dates, but you
can use format-number to produce strings with the desired leading
zeroes and punctuation. To map the "mm" field to month names, you
could just use xsl:if.

David Marston
LotusXSL Team


 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.