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

RE: Page X of Y

From: Al-Dhahir, Haitham <Haitham.Al-Dhahir@gs.com>
Date: Tue, 17 Sep 2002 16:49:25 +0100
Message-Id: <F17B2FF57CF8D41196CC0008C786CEAA0B57238E@gsln14e.ln.fw.gs.com>
To: www-xsl-fo@w3.org

Thanks Ken and Mike. The Page X of Y solution works fine!

However, I'm still having problems with the page-sequence-master.

To clarify: The document I am trying to generate is at least 1 page long and
at most 2 pages long. Hence, I have created the following layout-master-set:

<fo:layout-master-set>
	
	<fo:page-sequence-master master-name="seq-master">
		<fo:repeatable-page-master-alternatives>
			<fo:conditional-page-master-reference
page-position="first" master-name="first"/>
			<fo:conditional-page-master-reference
page-position="rest" master-name="rest"/>
		</fo:repeatable-page-master-alternatives>
	</fo:page-sequence-master>

	<fo:simple-page-master master-name="first" page-height="29.7cm"
page-width="21cm" margin-top="0cm" margin-bottom="0.5cm" margin-left="1.5cm"
margin-right="1.5cm">
		<fo:region-before extent="0.8cm"/>
		<fo:region-body margin-top="0.8cm"/>
		<fo:region-after extent="0.5cm"/>
	</fo:simple-page-master>

	<fo:simple-page-master master-name="rest" page-height="29.7cm"
page-width="21cm" margin-top="0cm" margin-bottom="0.5cm" margin-left="1.5cm"
margin-right="1.5cm">
		<fo:region-body margin-top="0.8cm"/>
		<fo:region-before extent="2cm"
region-name="rest-before-region"/>
		<fo:region-after extent="0.5cm"/>
	</fo:simple-page-master>
			
</fo:layout-master-set>

The rest of my XSL is then:

<fo:page-sequence master-reference="seq-master" initial-page-number="1">
		
	<fo:static-content flow-name="rest-before-region">
		<fo:block text-align="start" font-weight="normal">HEADING
TEXT FOR PAGES AFTER PAGE 1</fo:block>
      </fo:static-content>
         
	<fo:flow flow-name="xsl-region-body">
		..........
		..........
	</fo:flow>

</fo:page-sequence>

The idea is that "HEADING TEXT FOR PAGES AFTER PAGE 1" will appear at the
top of page 2, but not on page 1. However, when I try to convert this into
PDF using the FOP renderer, Xalan throws a TransformerException and FOP then
throws a NullPointerException. I have tried converting using the example XSL
at http://www.dpawson.co.uk/xsl/sect3/evenodd.html and even then the same
error is thrown. Can anyone help? Is there anything obviously wrong with my
use of page-sequence-master in the above XSL?

Thanks,

Haitham.

-----Original Message-----
From: Mike Haarman [mailto:mhaarma@socsci.umn.edu]
Sent: 16 September 2002 17:45
To: www-xsl-fo@w3.org
Subject: Re: Page X of Y



On Mon, 16 Sep 2002, 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

<fo:block>Page <fo:page-number/> of
<fo:page-number-citation ref-id="endofdoc"/></fo:block>

And place an empty block labled "endofdoc" at the end of the content of
the document like so:

<fo:block id="endofdoc"/>


> 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?

The following article contains an nice discussion of how to accomplish
this.  You'll use fo:repeatable-page-master-alternatives:

http://www.xml.com/pub/a/2001/01/17/xsl-fo/index.html?page=1

> Many thanks,

Many welcomes.


----------------------------------------------------------------
Mike Haarman
mhaarma@socsci.umn.edu
Received on Tuesday, 17 September 2002 11:49:55 GMT

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