Are you trying to get multiple invoices into a single PDF?
Is it possible you could split the XML to get a single file for each invoice?
The other answer offhand sounds like you want the last page citation reference to get a unique page tag for each invoice..

From: Steffanina, Jeff []
Sent: Tuesday, September 14, 2010 8:27 AM
Subject: RE: Page numbers

A single XML file contains many invoices.  Any single invoice may contain multiple pages.  For EACH invoice in the file, I need to produce a page count in the form of:  Page x of  z for that invoice.
Any ideas?

From: Georg Datterl []
Sent: Monday, September 13, 2010 3:00 PM
Subject: AW: Page numbers

Hi Jeff,


your block <fo:block id="last-page"> is inside of a <for-each>. So you probably get such a block once per invoice. You only want it on the last invoice.


Mit freundlichen Grüßen


Georg Datterl


------ Kontakt ------


Georg Datterl


Geneon media solutions gmbh

Gutenstetter Straße 8a

90449 Nürnberg


HRB Nürnberg: 17193

Geschäftsführer: Yong-Harry Steiert


Tel.: 0911/36 78 88 - 26

Fax: 0911/36 78 88 - 20


Weitere Mitglieder der Willmy MediaGroup:


IRS Integrated Realization Services GmbH:

Willmy PrintMedia GmbH:                  

Willmy Consult & Content GmbH:       


Von: Steffanina, Jeff []
Gesendet: Montag, 13. September 2010 20:48
Betreff: Page numbers



FOP 0.95  Java 5

I receive a single, large XML invoice file.  A single file contains multiple invoices of varying length.  When the XML contains only ONE invoice my page numbering works fine. I am trying to number the pages in the form of:   Page x  of  z

However, when I include multiple invoices within ONE  XML file, my "last-page" logic fails.  I get this error:
      ValidationException: Property id "last-page" previously used; id values must be unique in document.

When I remove the references to "last-page", my invoices print as expected.

Currently, I use the following logic:
 <fo:block-container position="absolute" top="2.0in" left="5.5in">
    <fo:block font-size="9pt" text-align="left">
       Page <fo:page-number/> of <fo:page-number-citation ref-id="last-page"/>

        <fo:block id="last-page">


Any suggestions?