2015-09-21 34 views
1

我有一個xsl文件來生成pdf。我想把頁腳放在最後一頁的底部。我tryed是這樣的:最後一頁底部的XSL-FO XSL-T頁腳

<?xml version="1.0" encoding="windows-1252"?> 

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 

<xsl:output method="html" encoding="windows-1252"/> 

<xsl:template match="/"> 

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> 

<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> 

      <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> 
    <html> 
     <fo:page-sequence master-reference="A4"> 
      <fo:static-content flow-name="xsl-region-before"> 
       <fo:block> 
        header 
       </fo:block> 
      </fo:static-content> 
      <fo:flow flow-name="xsl-region-body"> 
       body 
      </fo:flow> 
      <fo:static-content flow-name="xsl-region-after"> 
       <fo:block> 
        footer 
       </fo:block> 
      </fo:static-content> 
      </fo:page-sequence> 

    </html> 
    </fo:root> 
</xsl:template> 

頁腳出現在身體的末端,而不是在頁面的結束,我不知道如何做到這一點。

+0

當然,帶輸出類型html和html標籤的xsl不會生成文檔。尋找命名的一致性。你有一個名爲頁面的序列,你的頁面序列不會使用它,因爲它引用了A4大師。 –

回答

0

您的extentfo:region-afterfo:region-body上的margin-bottom值相同。如果您減少extent,那麼fo:region-after將不會一直延伸到fo:region-body的底部。

例如,參見http://www.antennahouse.com/antenna1/comprehensive-xsl-fo-tutorials-and-samples-collection/的「添加頁碼(頁碼)」示例的FO和PDF。該FO包括:

<fo:simple-page-master page-height="150mm" page-width="210mm" margin-top="10mm" 
    margin-left="20mm" margin-right="20mm" margin-bottom="10mm" master-name="PageMaster"> 
    <fo:region-before extent="15mm" /> 
    <fo:region-after extent="15mm" /> 
    <fo:region-body margin-top="0mm" margin-left="0mm" margin-right="0mm" margin-bottom="20mm" /> 
</fo:simple-page-master> 

您可以看到,這裏還有的extentmargin-bottom之間5mm的差異。