|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Currency format in a PDFHow can I include the currency format in a pdf document?
I have the FinalTotal value displayed in the table, but I would like to have the value formatted in the manner of $XXX,XXX.XX instead of the plain number value. Your comments are much appreciated. CODE BELOW: <fo:table-body> <fo:table-row border-after-style="double" > <fo:table-cell xsl:use-attribute-sets="cell-padding" border="solid black 0.5px" > <fo:block xsl:use-attribute-sets="detailtableright"> <xsl:value-of select="header/FinalTotal"/> </fo:block> </fo:table-cell> </fo:table-row> </fo:table-body> Thank you, jlr |
|
|
Re: Currency format in a PDFThis is handled in XSLT, not XSLFO. See http://www.w3schools.com/xsl/el_decimal-format.asp <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:decimal-format name="euro" decimal-separator="," grouping-separator="."/> <xsl:template match="/"> <xsl:value-of select="format-number(26825.8, '#.###,00', 'euro')"/> </xsl:template> </xsl:stylesheet> Output: 26.825,80 Cheers! Roger jlr schreef: > How can I include the currency format in a pdf document? > I have the FinalTotal value displayed in the table, but I would > like to have the value formatted in the manner of $XXX,XXX.XX > instead of the plain number value. > Your comments are much appreciated. > CODE BELOW: > > <fo:table-body> > <fo:table-row border-after-style="double" > > <fo:table-cell xsl:use-attribute-sets="cell-padding" > border="solid black 0.5px" > > <fo:block xsl:use-attribute-sets="detailtableright"> > <xsl:value-of select="header/FinalTotal"/> > </fo:block> > </fo:table-cell> > </fo:table-row> > </fo:table-body> > > Thank you, > jlr > |
|
|
Re: Currency format in a PDFOn Fri, May 23 2008 14:44:37 +0100, jean.stachler@... wrote: > How can I include the currency format in a pdf document? > I have the FinalTotal value displayed in the table, but I would > like to have the value formatted in the manner of $XXX,XXX.XX > instead of the plain number value. You have used format-number() in examples in other posts. Why not use it here, too? Regards, Tony Graham Tony.Graham@... Director W3C XSL FO SG Invited Expert Menteith Consulting Ltd XML, XSL and XSLT consulting, programming and training Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland Registered in Ireland - No. 428599 http://www.menteithconsulting.com -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- xmlroff XSL Formatter http://xmlroff.org xslide Emacs mode http://www.menteith.com/wiki/xslide Unicode: A Primer urn:isbn:0-7645-4625-2 |
|
|
Re: Currency format in a PDF - another question concerning cents portionFirst off, thank you for your reply, I have it working.
On to the second question....is there a way of displaying the zero amounts in a value such as 45.00? In the XML file, I see that the value of 45.00, but when it displays it displays like this 45 . I would like to display the full value of 45.00. This is the code that I have: <xsl:value-of select="format-number(FinalTotal, '###,###,###.##', 'usdollar')"/> Thanks in advance for anyone's comments, it is much appreciated. jlr
|
|
|
Re: Currency format in a PDF - another question concerning cents portionOn Fri, May 23 2008 18:33:47 +0100, jean.stachler@... wrote: ... > In the XML file, I see that the value of 45.00, but when it displays it > displays like this 45 . I would like to display the full value of 45.00. > > This is the code that I have: > <xsl:value-of select="format-number(FinalTotal, '###,###,###.##', > 'usdollar')"/> '###,###,###.00' or '###,###,##0.00' (if you want zero to be '0.00') or '$###,###,##0.00' (if you want zero to be '$0.00') Regards, Tony Graham Tony.Graham@... Director W3C XSL FO SG Invited Expert Menteith Consulting Ltd XML, XSL and XSLT consulting, programming and training Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland Registered in Ireland - No. 428599 http://www.menteithconsulting.com -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- xmlroff XSL Formatter http://xmlroff.org xslide Emacs mode http://www.menteith.com/wiki/xslide Unicode: A Primer urn:isbn:0-7645-4625-2 |
|
|
Re: Currency format in a PDF - another question concerning cents portionHi,
I am facing the same issue. Instead of 1,70 or 0,33..i want 1.70 or 0.33 respectively as my output. I dont know what is wrong with my code. Please suggest. <xsl:choose> <xsl:when test="(UNIT_PRICE,1,1 > 1) and (substring-before(UNIT_PRICE,',') > 0)"> <fo:table-cell xsl:use-decimal-format="euro2"> <fo:table-cell xsl:use-attribute-sets="table.cell5"> <fo:block xsl:use-attribute-sets="form_data1"> <xsl:value-of select="format-number(substring-before(UNIT_PRICE,','),'#.###','euro2')"/>,<xsl:if test="(substring(substring-after(UNIT_PRICE,','),3,1)) > 4"><xsl:value-of select="(substring(substring-after(UNIT_PRICE,','),1,5))"/></xsl:if> <xsl:if test="(substring(substring-after(UNIT_PRICE,','),3,1)) =''"><xsl:value-of select="(substring(substring-after(UNIT_PRICE,','),1,5))"/></xsl:if> <xsl:if test="(substring(substring-after(UNIT_PRICE,','),3,1)) = 1"><xsl:value-of select="(substring(substring-after(UNIT_PRICE,','),1,5))"/></xsl:if> <xsl:if test="(substring(substring-after(UNIT_PRICE,','),3,1)) = 2"><xsl:value-of select="(substring(substring-after(UNIT_PRICE,','),1,5))"/></xsl:if> <xsl:if test="(substring(substring-after(UNIT_PRICE,','),3,1)) = 3"><xsl:value-of select="(substring(substring-after(UNIT_PRICE,','),1,5))"/></xsl:if> <xsl:if test="(substring(substring-after(UNIT_PRICE,','),3,1)) = 4"><xsl:value-of select="(substring(substring-after(UNIT_PRICE,','),1,5))"/></xsl:if> <xsl:if test="(substring(substring-after(UNIT_PRICE,','),2,1)) = ''"><xsl:value-of select="((substring(substring-after(UNIT_PRICE,','),1,1))-(substring(substring-after(UNIT_PRICE,','),1,1)))"/></xsl:if> </fo:block> </fo:table-cell> </fo:table-cell> </xsl:when> <xsl:when test="(substring(UNIT_PRICE,1,1)=',')"> <fo:table-cell xsl:use-attribute-sets="table.cell5"> <fo:block xsl:use-attribute-sets="form_data1"> <xsl:value-of select="UNIT_PRICE"/> </fo:block> </fo:table-cell> </xsl:when> <!--changed , to . in the following xsl value-of for SCR PO-503 --> <xsl:when test="(UNIT_PRICE,1,1 > 1) and (substring-after(UNIT_PRICE,'.') > 0)"> <fo:table-cell xsl:use-decimal-format="euro2"> <fo:table-cell xsl:use-attribute-sets="table.cell5"> <fo:block xsl:use-attribute-sets="form_data1"> <xsl:value-of select="format-number(substring-before(UNIT_PRICE,'.'),'#.###','euro2')"/>,<xsl:if test="(substring(substring-after(UNIT_PRICE,'.'),3,1)) > 4"><xsl:value-of select="(substring(substring-after(UNIT_PRICE,'.'),1,5))"/></xsl:if> <xsl:if test="(substring(substring-after(UNIT_PRICE,'.'),3,1)) =''"><xsl:value-of select="(substring(substring-after(UNIT_PRICE,'.'),1,5))"/></xsl:if> <xsl:if test="(substring(substring-after(UNIT_PRICE,'.'),3,1)) = 1"><xsl:value-of select="(substring(substring-after(UNIT_PRICE,'.'),1,5))"/></xsl:if> <xsl:if test="(substring(substring-after(UNIT_PRICE,'.'),3,1)) = 2"><xsl:value-of select="(substring(substring-after(UNIT_PRICE,'.'),1,5))"/></xsl:if> <xsl:if test="(substring(substring-after(UNIT_PRICE,'.'),3,1)) = 3"><xsl:value-of select="(substring(substring-after(UNIT_PRICE,'.'),1,5))"/></xsl:if> <xsl:if test="(substring(substring-after(UNIT_PRICE,'.'),3,1)) = 4"><xsl:value-of select="(substring(substring-after(UNIT_PRICE,'.'),1,5))"/></xsl:if> <xsl:if test="(substring(substring-after(UNIT_PRICE,'.'),2,1)) = ''"><xsl:value-of select="((substring(substring-after(UNIT_PRICE,'.'),1,1))-(substring(substring-after(UNIT_PRICE,'.'),1,1)))"/></xsl:if> </fo:block> </fo:table-cell> </fo:table-cell> </xsl:when> <xsl:when test="(UNIT_PRICE,1,1 > 1 ) and (substring-after(UNIT_PRICE,',') ='') "> <fo:table-cell xsl:use-decimal-format="euro"> <fo:table-cell xsl:use-attribute-sets="table.cell5"> <fo:block xsl:use-attribute-sets="form_data1"> <xsl:value-of select="format-number(UNIT_PRICE,'#,###','euro')"/> </fo:block> </fo:table-cell> </fo:table-cell> </xsl:when> Thanks, Sumir
|
| Free Forum Powered by Nabble | Forum Help |