Shanto George
Shanto George

Reputation: 994

Distinguish between odd and even page in xsl

I have some table in my document and I want different margins for odd and even pages, so how can I distinguish a page is odd/even using when condition in xsl fo.

Upvotes: 0

Views: 485

Answers (1)

Tony Graham
Tony Graham

Reputation: 8068

You want:

  • Separate fo:simple-page-master for the odd and even pages
  • An fo:layout-master-set that selects the correct page master for odd and even pages. E.g.:
    <fo:page-sequence-master master-name="PageMaster">
      <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>
    
    See https://www.w3.org/TR/xsl11/#fo_page-sequence-master and https://www.w3.org/TR/xsl11/#odd-or-even for more information.
  • master-reference on your fo:page-sequence referring to the fo:page-sequence-master. E.g.:
    <fo:page-sequence master-reference="PageMaster">
    

Please also see the 'Switching between right and left page layouts' example PDF and FO in the 'XSL-FO Samples' page at https://www.antennahouse.com/xsl-fo-samples. There are other fo:page-sequence-master samples on that page as well.

Upvotes: 1

Related Questions