W3C home > Mailing lists > Public > www-xsl-fo@w3.org > December 2008

Re: Currency format in a PDF - another question concerning cents portion

From: dahepe <peger@gmx.net>
Date: Thu, 4 Dec 2008 04:36:27 -0800 (PST)
Message-ID: <20832573.post@talk.nabble.com>
To: www-xsl-fo@w3.org


> So, I have to manipulate this code in such a way that instead of
> displaying ,45 or .45,
> it should display 0,45 or 0.45 but 0 should not be appended in case when
> unit price
> is like 1.26 or 3.45..etc etc. How can incorporate this condition in the
> above code?

Try to use the following instructions to format the number is the way you
described (note that the decimal format must be declared only once!!):

<xsl:decimal-format name="us" decimal-separator="." grouping-separator=","/>
<xsl:value-of select="format-number(put-your-number-here, '#,##0.00',

Perhaps you should have a look at the documentation of the decimal-format,
format-number (http://www.w3.org/TR/xslt#function-format-number) and syntax
of the format string
(http://java.sun.com/javase/6/docs/api/java/text/DecimalFormat.html) to know
what you are doing...


View this message in context: http://www.nabble.com/Currency-format-in-a-PDF-tp17425898p20832573.html
Sent from the w3.org - www-xsl-fo mailing list archive at Nabble.com.
Received on Thursday, 4 December 2008 12:39:54 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:58:32 UTC