Reputation: 31
I'm trying to find a way to detect if the page being generated is odd or even in a template to left/right justify content. For example, a block of text with symbol next to it. The symbol would be left justified on one page, and right justified on the next.
I don't think checking fo:page-number is possible. And I can't figure out a way that would work with region-start/region-end because the symbol wouldn't line up with it's associated block of text in region-body.
<fo:layout-master-set>
<fo:simple-page-master master-name="EvenPage">
<fo:region-body />
</fo:simple-page-master>
<fo:simple-page-master master-name="OddPage">
<fo:region-body />
</fo:simple-page-master>
<fo:page-sequence-master master-name="Content">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="OddPage" odd-or-even="odd"/>
<fo:conditional-page-master-reference master-reference="EvenPage" odd-or-even="even"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="Content">
<fo:flow>
<xsl:apply-templates select="*"/>
</fo:flow>
</fo:page-sequence>
Upvotes: 2
Views: 988
Reputation: 8068
There is no if-statement to detect an odd or even page.
You could (or may be able to) use float="outside"
to float your symbol to the outside of the page. However, it's not clear to me from FOP's stated limitations on fo:float
support (http://xmlgraphics.apache.org/fop/fo.html#floats) whether float="outside"
is supported or not (although it is supported by other XSL formatters, including AH Formatter).
Upvotes: 1