different layout for region-body

Here should go questions about transforming XML with XSLT and FOP.
copilot1000
Posts: 1
Joined: Mon May 21, 2007 12:28 pm

different layout for region-body

Post by copilot1000 »

I am looking for a solution to have a different kind of layout in the region-body depending on whether the page is an odd or even one. so, not only different page-margins but also an own layout for a left page and another layout for a right page.
does anyone know, if that's possible at all?
as I can only specify one single flow-name="xsl-region-body", I do not know how to handle that.

here is a shortened version of my code:

Code: Select all


<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="RightPage" page-height="29.7cm" page-width="21cm">
<fo:region-body region-name="xsl-region-body"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="LeftPage" page-height="29.7cm" page-width="21cm">
<fo:region-body region-name="xsl-region-body"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="Chapter">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="RightPage" odd-or-even="odd"/>
<fo:conditional-page-master-reference master-reference="LeftPage" odd-or-even="even"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>

<xsl:for-each select="./book/chapter">
<fo:page-sequence master-reference="Chapter" force-page-count="even" initial-page-number="auto">
<!-- Chapters -->
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates select="section"/>
</fo:flow>
</fo:page-sequence>
</xsl:for-each>
</fo:root>
</xsl:template>
<xsl:template match="section">
<xsl:for-each select=".">
<!-- output of nodes depending on left or right page -->
</xsl:for-each>
</xsl:template>

or is there any possibility to know, whether the actual page is an odd or an even page?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: different layout for region-body

Post by sorin_ristache »

Hello,
copilot1000 wrote:is there any possibility to know, whether the actual page is an odd or an even page?
I think that is not possible. The page depends on the font size and on the previous content. It is very hard to compute the exact page where an element will be placed.


Regards,
Sorin
Post Reply