[xep-support] Alternating body templates with XSL-FO

From: Jerry Janofsky <JanofskyJ@comcast.net>
Date: Tue Aug 22 2006 - 06:46:29 PDT

I have an XSL-FO question.

 

I am generating a book that may have hundreds of pages. For the general
chapters (not concerned with title pages, index, etc.) I need to be able to
alter body templates based on even and odd pages. I already understand how
to do this for the static content on the page (region before and region
after areas) but have been unable to do it for the body.

 

 

Does anyone know if it is possible to have a conditional page body depending
on whether or not the page is even or odd? I understand how to have
conditional page-before and page-after (static content) styles. But I also
want the body text (flow) to be formatted differently depending on whether
or not the page is even or odd.

Below you can see my attempt at this by creating "body-even" and "body-odd"
in the even and odd master sets. This attempt, however, just fills up all
the odd pages leaving the even pages blank. I think it might be possible
doing something similar to what I am doing, but I just don't have it quite
right. It would also be possible if, in my XSL, I could somehow say. "If
even" or "If odd" and then call the appropriate template.

 

Your input would be appreciated.

 

Jerry J

 

 

<fo:layout-master-set>

<!-- Even pages - 5.5 in x 8.5 in size -->
<fo:simple-page-master master-name="even" page-height="8.5in"
page-width="5.5in>
<fo:region-body region-name="body-even" border="1pt solid black"
display-align="before" margin-left="0.3125in" margin-right="0.75in"
margin-top="0.5in" margin-bottom="0.5in"/>
<fo:region-before region-name="even-before" border="1pt solid black"
display-align="before" extent="0.3125in"/>
<fo:region-after region-name="even-after" border="1pt solid black"
display-align="after" extent="0.3125in"/>
</fo:simple-page-master>

<!-- Odd pages - 5.5 in x 8.5 in size -->
<fo:simple-page-master master-name="odd" page-height="8.5in"
page-width="5.5in">
<fo:region-body region-name="body-odd" border="1pt solid black"
display-align="before" margin-left="0.75in" margin-right="0.3125in"
margin-top="0.5in" margin-bottom="0.5in"/>
<fo:region-before region-name="odd-before" border="1pt solid black"
display-align="before" extent="0.3125in"/>
<fo:region-after region-name="odd-after" border="1pt solid black"
display-align="after" extent="0.3125in"/>
</fo:simple-page-master>

<fo:page-sequence-master master-name="chapter">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="odd"
page-position="any" odd-or-even="odd"/>
<fo:conditional-page-master-reference master-reference="even"
page-position="any" odd-or-even="even"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>

<fo:page-sequence master-reference="chapter">
<fo:static-content flow-name="even-before">
<fo:block>
</fo:block>
</fo:static-content>
<fo:static-content flow-name="odd-before">
<fo:block>
</fo:block>
</fo:static-content>

<fo:static-content flow-name="even-after">
<fo:block>
<fo:page-number/>
</fo:block>
</fo:static-content>
<fo:static-content flow-name="odd-after">
<fo:block>
<fo:page-number/>
</fo:block>
</fo:static-content>

<fo:flow flow-name="body-odd">
"LOTS OF XML DATA HERE"
</fo:flow>
<fo:flow flow-name="body-even">
"LOTS OF XML DATA HERE"
</fo:flow>
</fo:page-sequence>

 

-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo@renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.html
Received on Tue Aug 22 06:55:48 2006

This archive was generated by hypermail 2.1.8 : Tue Aug 22 2006 - 06:55:52 PDT