Re: Page X of Y

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 UTC