Subject: Re: formatting numbers and dates From: David_Marston@xxxxxxxxx Date: Tue, 28 Dec 1999 15:25:48 -0500 |
>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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
formatting numbers and dates, Jay Fisher | Thread | removing duplicates problem, Jeremy Quinn |
Re: HTML Forms and XSL, James Garriss | Date | removing duplicates problem, Jeremy Quinn |
Month |