如何从第2页或第3页开始页码?

时间:2017-05-05 07:45:41

标签: xml xslt xpath xsl-fo

这是我的代码:

instanceof

只有一个幻灯片序列,但我想从第一个开始编号,但是从幻灯片2或幻灯片3开始编号。有人可以帮我怎么做?

2 个答案:

答案 0 :(得分:2)

为没有fo:simple-page-master的第一页单独fo:region-after并使用fo:page-sequence-master为第一页指定特殊fo:simple-page-master,然后使用其余幻灯片定期fo:simple-page-master。 E.g:

<fo:layout-master-set>
    <fo:simple-page-master master-name="first">
        <fo:region-body margin="36pt" />
    </fo:simple-page-master>
    <fo:simple-page-master master-name="rest">
        <fo:region-body margin="36pt" />
        <fo:region-after extent="36pt" />
    </fo:simple-page-master>
    <fo:page-sequence-master master-name="psm">
      <fo:single-page-master-reference master-reference="first" />
      <fo:repeatable-page-master-reference master-reference="rest" />
    </fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="psm">
  <fo:static-content flow-name="xsl-region-after">
    <fo:block text-align="right" font-size="20pt" margin-right="0.5cm">
      <fo:page-number/>
    </fo:block>
    </fo:static-content>
    <fo:flow flow-name="xsl-region-body">
      <xsl:apply-templates />
    </fo:flow>
</fo:page-sequence>

对于未编号的第一张幻灯片和编号为&#39; 1&#39;的第二张幻灯片,将第一张幻灯片放在单独的fo:page-sequence中:

<fo:layout-master-set>
    <fo:simple-page-master master-name="first">
        <fo:region-body margin="36pt" />
    </fo:simple-page-master>
    <fo:simple-page-master master-name="rest">
        <fo:region-body margin="36pt" />
        <fo:region-after extent="36pt" />
    </fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="first" force-page-count="no-force">
    <fo:flow flow-name="xsl-region-body">
      <fo:block>Title slide</fo:block>
    </fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="rest" initial-page-number="1">
  <fo:static-content flow-name="xsl-region-after">
    <fo:block text-align="right" font-size="20pt" margin-right="0.5cm">
      <fo:page-number/>
    </fo:block>
    </fo:static-content>
    <fo:flow flow-name="xsl-region-body">
      <fo:block>Slide 1</fo:block>
    </fo:flow>
</fo:page-sequence>

其中,如果页码的存在是唯一的区别,可以简化为:

<fo:layout-master-set>
    <fo:simple-page-master master-name="spm">
        <fo:region-body margin="36pt" />
        <fo:region-after extent="36pt" />
    </fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="spm" force-page-count="no-force">
    <fo:flow flow-name="xsl-region-body">
      <fo:block>Title slide</fo:block>
    </fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="spm" initial-page-number="1">
  <fo:static-content flow-name="xsl-region-after">
    <fo:block text-align="right" font-size="20pt" margin-right="0.5cm">
      <fo:page-number/>
    </fo:block>
    </fo:static-content>
    <fo:flow flow-name="xsl-region-body">
      <fo:block>Slide 1</fo:block>
    </fo:flow>
</fo:page-sequence>

答案 1 :(得分:1)

您必须为第一页创建一个simple-page-master,为后续页创建一个。在page-sequence-master中,指定哪个页面位置应使用哪个page-master

<fo:page-sequence-master master-name="chapter">
    <fo:repeatable-page-master-alternatives>
        <fo:conditional-page-master-reference master-reference="page_first" page-position="first"/>
        <fo:conditional-page-master-reference master-reference="page_even" odd-or-even="even"/>
        <fo:conditional-page-master-reference master-reference="page_odd" odd-or-even="odd"/>
    </fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>

在第一页的simple-page-master中,使用&#34; xsl-region-after&#34;以外的区域名称。对于region-after,所以静态内容块名为&#34; xsl-region-after&#34;将不会在第一页上绘制。