xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J.Pietschmann" <j3322...@yahoo.de>
Subject Re: Page counter for multiple page-sequences
Date Wed, 04 Sep 2002 18:41:04 GMT
Paul Kowlessar wrote:
> I am using multiple page-sequence elements.  Each page-sequence can
 > span multiple pages.  My question is how can I display the total
 > number of pages for each page-sequence?  The format would be
 > "Page # of #" for each page-sequence.  Your help in this matter
 > will be greatly appreciated.
It depends whether all page sequences start with page number
one, or are numbered continuously.
It the first case, this is a FAQ, check for example the XSL
FAQ reachable from http://www.mulberrytech.com/xsl/xsl-list/

The trick is to insert an empty block at the end of
each flow and reference it in a page-number-citation
   <fo:page-sequence>
     <fo:static-content ...>
       <fo:block>Page <fo:page-number/> of <fo:page-number-citation
          ref-id="lastblock"/></fo:block>
    </fo:static-content>
    <fo:flow ...>
      ....
      <fo:block id="lastblock"/>
    </fo:flow>
   </fo:page-sequence>
If you are using multiple page sequences, the "lastblock"
must be different for each page sequence. If you are using
XSLT to generate the FO, you can use the generate-id()
function to achieve this (the XSL FAQ mentions a few more
possibilities).
Note that you can only get page numbers as seen on the page,
not page counts. You can't use this technique to get the total
number of pages of the whole document in the discussed case,
nor would it work if the pages are numbered continuously.

If you are after one of the latter cases, you can use a multi
pass technique. Make a pass for each page sequence to render,
memorize the number of pages rendered for the page sequence,
and then make a final pass, passing the page numbers as
parameters to the XSLT processor for insertion in the document.
This can be automated with a simple Java wrapper, look here
for some code to start:
  http://marc.theaimsgroup.com/?l=fop-user&m=102002702026609&w=2
In your case it would be more complicated, because of the multiple
passes caused by multiple page sequences.

J.Pietschmann




Mime
View raw message