XSL FO:页眉和页脚内容正在被覆盖

时间:2011-02-08 19:17:14

标签: xml xsl-fo

我正在使用XSL-fo生成modspecs的pdf版本(在docbook中)。我目前正在使用这个XSLT来控制转换:

...
<xsl:param name="footer.rule" select="0"/>
<xsl:param name="header.rule" select="1"/>
<xsl:param name="fop.extensions" select="0"/>
<xsl:param name="fop1.extensions" select="1"/>

<xsl:template match="node()|@*">
    <xsl:copy>
        <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
</xsl:template>

<xsl:template name="footer.content">
    <xsl:param name="pageclass" select="''"/>
    <xsl:param name="sequence" select="''"/>
    <xsl:param name="position" select="''"/>
    <xsl:param name="gentext-key" select="''"/>
    <fo:block space-before="12pt" keep-together.within-page="auto"/>
    <xsl:choose>
        <xsl:when test="$position = 'left'">
            <fo:block>Acme Corp</fo:block>
            <fo:block><fo:leader leader-pattern="space"/></fo:block>
        </xsl:when>
        <xsl:when test="$position = 'right'">
            <fo:block>Cool Stuff</fo:block>
            <fo:block>Page <fo:page-number/> of <fo:page-number-citation ref-id="last-page"/></fo:block>
        </xsl:when>
    </xsl:choose>
</xsl:template>
<xsl:template name="header.content">
    <xsl:param name="pageclass" select="''"/>
    <xsl:param name="sequence" select="''"/>
    <xsl:param name="position" select="''"/>
    <xsl:param name="gentext-key" select="''"/>
    <xsl:choose>
        <xsl:when test="$position = 'left'">
            <fo:block><fo:inline font-weight="bold"><xsl:value-of select="$app_name"/> - <xsl:value-of select="d:title/text()"/></fo:inline></fo:block>
            <fo:block>
                <fo:retrieve-marker retrieve-class-name="section.head.marker"
                    retrieve-position="first-including-carryover"
                    retrieve-boundary="page-sequence"/>
            </fo:block>
        </xsl:when>
        <xsl:when test="$position = 'right'">
            <fo:block>Version <xsl:value-of select="$app_version"/></fo:block>
            <fo:block> Build <xsl:value-of select="$build_number"/></fo:block>
        </xsl:when>
    </xsl:choose>
</xsl:template>

现在页眉和页脚显示正常,但出于某种原因(特别是在modspec的早期页面上),页面内容与页眉和页脚重叠。有没有办法解决它,所以不再有任何重叠?

1 个答案:

答案 0 :(得分:0)

尝试调整一些控制页面布局的参数。我会从body.margin.topbody.margin.bottom开始。请参阅http://www.sagehill.net/docbookxsl/PrintOutput.html#PageLayout

相关问题