Distinguish between odd and even page in xsl

≡放荡痞女 提交于 2021-02-11 12:34:57

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/65700064/distinguish-between-odd-and-even-page-in-xsl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!