2012-07-31 11 views
6

Ich möchte ein PDF-Dokument mit einer Kopf- und Fußzeile auf jeder Seite erstellen, ich weiß nicht, warum sie nur auf ungeraden Seiten erscheint.Header und Footer XSL FO

Ich vereinfache den Code und ich erstelle eine Tabelle und ich wiederholte mehrmals, um 4 Seiten zu haben, aber das Ergebnis ist das gleiche, die Kopf- und Fußzeile erscheint nur auf der ersten und der dritten Seite.

Hier ist der Code. Die xsl-Version ist 1.0.

<xsl:output indent="yes"/> 

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

    <fo:layout-master-set> 
<!-- layout information --> 
<fo:simple-page-master master-name="pagetemplate" 
       page-height="29.7cm" 
       page-width="21cm" 
       margin-top="1cm" 
       margin-bottom="0.1cm" 
       margin-left="0.8cm" 
       margin-right="1.0cm"> 
    <fo:region-body margin-top="2.5cm" margin-bottom="2.5cm"/> 
    <fo:region-before extent="2.0cm"/> 
    <fo:region-after extent="2.0cm"/> 
</fo:simple-page-master> 
</fo:layout-master-set> 

<fo:page-sequence master-reference="pagetemplate"> 

      <fo:static-content flow-name="xsl-region-before"> 
     <fo:block> 
      <xsl:call-template name="header"/> 
     </fo:block> 
     </fo:static-content> 

     <fo:static-content flow-name="xsl-region-after"> 
     <fo:block> 
     <xsl:call-template name="footer"/> 
     </fo:block> 
     </fo:static-content> 

     <fo:flow flow-name="xsl-region-body"> 

    <xsl:call-template name="block"/> 
      <xsl:call-template name="block"/> 
      <xsl:call-template name="block"/> 
      <xsl:call-template name="block"/> 

     </fo:flow> 

</fo:page-sequence> 

</fo:root> 

</xsl:template> 

Antwort

2

Ich löse das Problem.

Die Sache war, dass die Ränder von Region-Body, Region-Vorher und Region-After nicht korrekt waren.