0
votes

I'm generating a pdf version of modspecs (in docbook) using XSL-fo. Im currently using this XSLT to control the transform:

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

Now the header and footer are showing up fine, but for some reason (especially on the early pages of the modspec), the content of the page are overlapping the both the header and footer. Is there a way to fix it so there is no longer any overlap?

1
Ace, is this a question about 1) the XSLT (how to produce the desired FO output), or 2) what FO output to produce, or 3) why the FO doesn't produce the expected PDF? If 1, please show the desired FO output vs. the actual FO output. If 2 (which I think it is), why are you showing us your XSLT? Please show (a representative sample of) your current FO output, including the page content. If 3, please state what FO processor you're using.LarsH
@ LarsH: Well it's mostly question 1) actually. I'm hoping the XSLT can be fixed so that it prevents content overflow. Screen shot wise I think it's a bit redundant. Currently content from the previous page garbling with the header, the content of the content of the current page is garbling with the footer. Ideally content from the prev. page appears below header, content from the current page stops when it reaches footer.Ace
This is not about XSLT. For what it's worth, you could build the FO document with any language and you will still have such specific XSL-FO XML vocabulary problemuser357812

1 Answers

0
votes

Try adjusting some of the parameters that control page layout. I would start with body.margin.top and body.margin.bottom. See http://www.sagehill.net/docbookxsl/PrintOutput.html#PageLayout.