« Return to Thread: Currency format in a PDF

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

by dahepe :: Rate this Message:

Reply to Author | View in Thread

Hi,

> 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', 'us')"/>

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...

Regards,
Daniel

 « Return to Thread: Currency format in a PDF