Re: Page-sequence vs page-counter

An example is better than trying to explain and failing. Still, please
note that keeping counters won't help you since the formatting is done
after the XSLT stage. You can simply forget about trying to keep track
of page numbers in XSLT.

With XSL-FO 1.0 you can use an empty fo:block at the end of the fo:flow
and reference that in a fo:page-number-citation.
-->invoice2fo10.xsl

With XSL-FO 1.1 you can set an "id" on the page-sequence and reference
that using fo:page-number-citation-last.
-->invoice2fo11.xsl

Both example use IDs. Since you have multiple invoices (i.e. multiple
page-sequences), you have to generate unique IDs. If you have a unique
number for each invoice you can use that. Otherwise, you can simply use
the index of the invoice in the XML file as I have done in the example.

invoices.xml is just some data to make the transformation go.

HTH
Jeremias Maerki (hoping the attachments make it through)



On 01.10.2007 23:29:40 Roger wrote:
> 
> Hello list!
> 
> I'm trying to create a PDF with invoices. Each invoice can have  
> multiple pages and I would like to display the number of pages per  
> invoice. So a pdf can have 5 pages, first invoice with 3 pages,  
> second with 2. The first should have 1/3, 2/3 and 3/3, the second 1/2  
> and 2/2 as page numbers.
> 
> I have added a simple page counter, but it doesn't work properly. I  
> get 1/3, 2/3. 3/3, and then 4/5 and 5/5. I probably can find a way  
> around this by substracting the total amount of pages for previous  
> invoices, but I hope it can be done easier.
> 
> If I search for solutions I find references to fo:page-sequence. But  
> if I try to do something with it, the PDF becomes invalid. So I  
> wonder how I can solve this. I probably don't understand page- 
> sequence properly. I think I can solve my problem if I understand how  
> it works.
> 
> Thanks for your time!
> 
> Roger
> 
> 

Received on Thursday, 4 October 2007 13:09:46 UTC