XSL-FO - 奇数页/左手页,偶数页/右手页和空白页

以下是XSL-FO奇数页,偶数页和空白页的定义和示例代码。

 

奇数页:

偶数页:

空白页:

示例代码:

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="odd-page" 
page-width="8.48in" page-height="10.98in" margin-top="0.4in" margin-bottom="0.4in">
<fo:region-body  region-name="xsl-region-body"
margin-top="1in" margin-bottom="1in" margin-left="1.2in" margin-right="0.4in"/>
<fo:region-before  region-name="xsl-region-odd-before" extent="1in"/>
<fo:region-after  region-name="xsl-region-odd-after" extent="1in"/>
<fo:region-start  region-name="xsl-region-odd-start" extent="1.2in"/>
<fo:region-end  region-name="xsl-region-odd-end" extent="0.4in"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="even-page" 
page-width="8.48in" page-height="10.98in" margin-top="0.4in" margin-bottom="0.4in">
<fo:region-body  region-name="xsl-region-body"
margin-top="1in" margin-bottom="1in" margin-left="0.4in" margin-right="1.2in" />
<fo:region-before  region-name="xsl-region-even-before" extent="1in"/>
<fo:region-after  region-name="xsl-region-even-after" extent="1in"/>
<fo:region-start  region-name="xsl-region-even-start" extent="0.4in"/>
<fo:region-end  region-name="xsl-region-even-end" extent="1.2in"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="blank-page" 
page-width="8.48in" page-height="10.98in" margin-top="0.4in" margin-bottom="0.4in">
<fo:region-body  region-name="xsl-region-body"
margin-top="1in" margin-bottom="1in" margin-left="1.2in" margin-right="0.4in" />
<fo:region-before  region-name="xsl-region-blank-before" extent="6in"/>
<fo:region-after  region-name="xsl-region-blank-after" extent="1in"/>
<fo:region-start  region-name="xsl-region-blank-start" extent=".4in"/>
<fo:region-end  region-name="xsl-region-blank-end" extent="1.2in"/>
</fo:simple-page-master>

<fo:page-sequence-master master-name="section">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference blank-or-not-blank="not-blank" odd-or-even="odd" master-reference="odd-page"/>
<fo:conditional-page-master-reference blank-or-not-blank="not-blank" odd-or-even="even" master-reference="even-page"/>
<fo:conditional-page-master-reference blank-or-not-blank="blank" master-reference="blank-page"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>

<fo:page-sequence master-reference="section" force-page-count="even">
<fo:static-content flow-name="xsl-region-blank-before">
<fo:block text-align="left" border-bottom="1pt solid black" font-style="italic" margin-top="0.5in">
Page - <fo:page-number/></fo:block>
<fo:block space-before="100mm" text-align="center" font-weight="bold">INTENTIONALLY LEFT BLANK</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-odd-before">
<fo:block text-align="right" border-bottom="1pt solid black" font-style="italic" margin-top="0.5in">
Page - <fo:page-number/></fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-even-before">
<fo:block text-align="left" border-bottom="1pt solid black" font-style="italic" margin-top="0.5in">
Page - <fo:page-number/></fo:block>
</fo:static-content>

<fo:flow flow-name="xsl-region-body">
<fo:block space-before="10pt" space-after="10pt">
This document has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a 
W3C Recommendation. It is a stable document and may be used as reference material or cited as a normative reference 
from another document. W3C's role in making the Recommendation is to draw attention to the specification and to 
promote its widespread deployment. This enhances the functionality and interoperability of the Web.
</fo:block> 
<fo:block space-before="10pt" space-after="10pt">
The system-font function returns a characteristic of a system font. The first argument is the name of the system 
font and the second argument, which is optional, names the property that specifies the characteristic. If the 
second argument is omitted, then the characteristic returned is the same as the name of the property to which 
the expression is being assigned.
</fo:block> 
<fo:block space-before="10pt" space-after="10pt">
The background-color property on the fo:block is assigned the value "red" because the (computed, after 
inheritance) value of the color (not background-color) property on the fo:list-item-body that is the parent 
of fo:block is "red".
</fo:block>
<fo:block space-before="10pt" space-after="10pt">
...
</fo:block>
<fo:block space-before="10pt" space-after="10pt">
The fo:bookmark formatting object is used to identify an access point, by name, and to specify where that 
access point is within the current document or another external document. A given bookmark may be further 
subdivided into a sequence of (sub-)bookmarks to as many levels as the authors desire.
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值