You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Ross Nicholls <ro...@kinnersley.com> on 2005/10/31 19:10:06 UTC

Alternating Header/Footer on Odd and Even pages

Hi there,

Maybe this is an easy one, in which case I apologise!
I have an alternating page sequence that simply switches the left and right hand margins (for binding). However, I also need the header (a 2 cell table placed in xsl-region-before) to be mirrored on alternating pages. i.e. The 2 cells consist of a logo image on the left and a heading text block on the right. This is correct for Left-hand (Odd) pages, but needs to be the other way round for Right-hand pages (Even) - so that the logo is always on the outside edge. Does anyone have any ideas how to achieve this?

Thanks in advance for any assistance.

Ross

Re: Alternating Header/Footer on Odd and Even pages

Posted by Ross Nicholls <ro...@kinnersley.com>.
You're the man Glen - worked a treat!

Thanks

----- Original Message ----- 
From: "Glen Mazza" <gm...@apache.org>
To: <fo...@xmlgraphics.apache.org>
Sent: Monday, October 31, 2005 6:59 PM
Subject: Re: Alternating Header/Footer on Odd and Even pages


> Ross Nicholls wrote:
>
> > Hi there,
> >
> > Maybe this is an easy one, in which case I apologise!
> > I have an alternating page sequence that simply switches the left and
> right hand margins (for binding). However, I also need the header (a 2 
> cell table placed in xsl-region-before) to be mirrored on alternating 
> pages. i.e. The 2 cells consist of a logo image on the left and a heading 
> text block on the right. This is correct for Left-hand (Odd) pages, but 
> needs to be the other way round for Right-hand pages (Even) - so that the 
> logo is always on the outside edge. Does anyone have any ideas how to 
> achieve this?
> >
> > Thanks in advance for any assistance.
> >
> > Ross
>
>
> Oh, this is a fun problem.  I think you want to define two 
> fo:static-contents in the fo:page-sequence, with different 
> flow-names--given them the values of "region-before-left" and 
> "region-before-right" or similar.  Within these two fo:static-contents 
> define the different header layouts desired.
>
> Next, create two fo:simple-page-masters, identical in every way except 
> they have a different region-name property for the fo:region-before. One's 
> region-name is called "region-before-left" and the other 
> "region-before-right".
>
> Finally, create an fo:repeatable-page-master-alternatives, with different 
> "odd-or-even" properties, as here[1].  Have the "odd" one reference the 
> fo:s-p-m with a region-body w/region-name of "region-before-right", and 
> the "even" one reference the fo:s-p-m with "region-before-left".
>
> This will result in the fo:static-content with flow-name of r-b-r being 
> ignored on even pages (and hence not rendered), and the one with r-b-l 
> being ignored on odd ones.  Or something like that.  ;-)
>
> Glen
>
> [1] 
> http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/fo/pagination/franklin_alt.fo?rev=197515&view=markup
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Alternating Header/Footer on Odd and Even pages

Posted by Glen Mazza <gm...@apache.org>.
Ross Nicholls wrote:

 > Hi there,
 >
 > Maybe this is an easy one, in which case I apologise!
 > I have an alternating page sequence that simply switches the left and 
right hand margins (for binding). However, I also need the header (a 2 
cell table placed in xsl-region-before) to be mirrored on alternating 
pages. i.e. The 2 cells consist of a logo image on the left and a 
heading text block on the right. This is correct for Left-hand (Odd) 
pages, but needs to be the other way round for Right-hand pages (Even) - 
so that the logo is always on the outside edge. Does anyone have any 
ideas how to achieve this?
 >
 > Thanks in advance for any assistance.
 >
 > Ross


Oh, this is a fun problem.  I think you want to define two 
fo:static-contents in the fo:page-sequence, with different 
flow-names--given them the values of "region-before-left" and 
"region-before-right" or similar.  Within these two fo:static-contents 
define the different header layouts desired.

Next, create two fo:simple-page-masters, identical in every way except 
they have a different region-name property for the fo:region-before. 
One's region-name is called "region-before-left" and the other 
"region-before-right".

Finally, create an fo:repeatable-page-master-alternatives, with 
different "odd-or-even" properties, as here[1].  Have the "odd" one 
reference the fo:s-p-m with a region-body w/region-name of 
"region-before-right", and the "even" one reference the fo:s-p-m with 
"region-before-left".

This will result in the fo:static-content with flow-name of r-b-r being 
ignored on even pages (and hence not rendered), and the one with r-b-l 
being ignored on odd ones.  Or something like that.  ;-)

Glen

[1] 
http://svn.apache.org/viewcvs.cgi/xmlgraphics/fop/trunk/examples/fo/pagination/franklin_alt.fo?rev=197515&view=markup


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org