2013-10-15 45 views
1

我有一個帶頁眉和頁腳的XSL-FO文件。最後一頁的XSL-FO頁腳

我爲頁眉和頁腳添加了靜態內容,但是我希望頁腳僅顯示在最後一頁上。

我該怎麼做?

<?xml version="1.0" encoding="ISO-8859-1"?> 
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> 
    <fo:layout-master-set> 
     <fo:simple-page-master master-name="A4" page-width="210mm" page-height="297mm" margin-top="1cm" margin-bottom="1cm" 
           margin-left="1cm" margin-right="1cm"> 
      <fo:region-body margin-top="90mm" margin-bottom="80mm"/> 
      <fo:region-before extent="90mm"/> 
      <fo:region-after extent="80mm"/> 
      <fo:region-start/> 
      <fo:region-end/> 
     </fo:simple-page-master> 
    </fo:layout-master-set> 
    <fo:page-sequence master-reference="A4"> 
     <fo:static-content flow-name="xsl-region-before"> 
      <fo:block> 
       <fo:external-graphic src="images/logo.png" content-width="scale-to-fit" height="50mm"/> 
      </fo:block> 
     </fo:static-content> 
     <fo:static-content flow-name="xsl-region-after"> 
      <fo:block> 
       <fo:external-graphic src="images/signature.gif" content-width="scale-to-fit" height="50mm"/> 
      </fo:block> 
     </fo:static-content> 
     <fo:flow flow-name="xsl-region-body"> 
      ... 
     </fo:flow> 
    </fo:page-sequence> 
</fo:root> 

回答

3

<fo:layout-master-set>,您可以定義一個頁面序列:

<page-sequence-master master-name="pages"> 
    <repeatable-page-master-alternatives> 
    <conditional-page-master-reference page-position="last" master-reference="last-page"/> 
    <conditional-page-master-reference master-reference="other-page"/> 
    </repeatable-page-master-alternatives> 
</page-sequence-master> 

然後你可以定義一個簡單的頁面主的最後一頁,其中包含一個區域,之後只出現在這頁。

Tutorial

+0

謝謝,解決我的問題 – javapenguin

+1

您可以點擊旁邊的選中標記我的回答,表明它解決您的問題... – Hobbes