0
votes

I am currently trying to use Apache-FOP for generating Invoices. Using <fo:retrieve-marker/> and <fo:marker/> I am able to create Subtotals for every page.

I want to format this number properly:

          <fo:block text-align="right">
            <fo:retrieve-marker retrieve-class-name="invoice-subtotal" retrieve-boundary="page" retrieve-position="last-starting-within-page"/>
          </fo:block>

Just gives me the plain Sum (e.g. 12045), want I want to have is 120,45. Is this possible with just Apache-FOP 1.1? Retrieving this number is done after the XSLT processor, so I cant use XSLT formatting functions.

Thanks for your help.

1
Are you using XSLT to create the XSL-FO? If so, can't you use format-number() when you are creating the fo:marker? If you need both formatted and unformatted, you could create 2 fo:markers.Daniel Haley
See my answer below. I did use XSLT for creating the XSL-FO, but what I also did was calculating the numbers in the XSLT.bjoernhaeuser

1 Answers

1
votes

Ok. What I asked does not seem to be possible. What I did before was calculating the intermediate sum with XSLT:

<fo:marker marker-class-name="invoice-subtotal"><xsl:value-of select="itemTax/grossPriceRaw + sum(preceding::itemTax/grossPriceRaw)"/></fo:marker>

What I did to solve the problem is that every position in my invoice now holds the intermediate sum. So calculating and formatting is up to the programming language (in this case java).

My marker definition now looks like this:

<fo:marker marker-class-name="invoice-subtotal"><xsl:value-of select="intSum"/></fo:marker>

So everything works fine now.

Thanks for your help.