W3C home > Mailing lists > Public > www-xsl-fo@w3.org > September 2002

Re: Page X of Y

From: G. Ken Holman <gkholman@CraneSoftwrights.com>
Date: Mon, 16 Sep 2002 18:24:45 +0200
Message-Id: <5.1.0.14.0.20020916181334.039b97f8@pop.storm.ca>
To: "'www-xsl-fo@w3.org'" <www-xsl-fo@w3.org>

At 2002-09-16 16:46 +0100, Al-Dhahir, Haitham wrote:
>I have a multi-page document, and on each page I'd like to display the page
>number. However, I want to display this in the form:
>
>Page X of Y
>
>Where X is the number of the current page, and Y is the total number of
>pages in the document.

At the very end of your flow, add an empty block with the id="the id of the 
last page of the block".

Then you can say "Page <page-number/> of <page-number-citation ref-id="the 
id of the last page in the block"/>".

I suggest people use

    <block id="{generate-id(/)}"/>

and

    <page-number-citation ref-id="{generate-id(/)}"/>

so as to not confuse the ID you use with the ID values generated with 
ID/IDREF in the user's XML document.  To ensure *they* aren't confused, I 
suggest people use generate-id(.) as a replacement for ID wherever it is 
used.  XSLT guarantees they will all be unique, even if you are 
incorporating XML information from more than one document, where each 
document will have unique ID values but the set of documents may not have 
unique ID values.

>A follow-up question: if I have a two-page document, and I want the page
>number to be displayed in a different position on the second page than it is
>on the first page, how can I achieve this?

By creating a page-sequence-master that alternates even and odd page 
numbers (assuming you mean even/odd and not just first and second pages) 
with uniquely named static content.

These are frequently asked questions:

    http://www.dpawson.co.uk/xsl/sect3/ under Page Numbering
    http://www.dpawson.co.uk/xsl/sect3/ under Even and Odd pages sequences

I hope this helps.

..................... Ken

--
Upcoming hands-on in-depth    Europe:         Sep 18-Sep 20,2002
XSLT/XPath and XSL-FO         North America:  Sep 30-Oct  4,2002

G. Ken Holman               mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.        http://www.CraneSoftwrights.com/f/
Box 266, Kars, Ontario CANADA K0A-2E0  +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                     Definitive XSLT and XPath
ISBN 0-13-140374-5                             Definitive XSL-FO
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-10-1             Practical Formatting Using XSL-FO
Next public training: 2002-09-18,19,30,10-03,12-08,2003-03-04,07
Received on Monday, 16 September 2002 12:25:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:09 GMT