XSL-FO:在页面序列中调用xsl-template?

时间:2018-06-07 16:59:29

标签: xml pdf xsl-fo apache-fop

我的xsl-template在页面序列中被调用,它包含一个静态头。该模板包含一个margin-top =" 30mm"的块。我的问题是边缘顶部仅应用于第一页。我希望页面序列的所有页面都有相同的边距(30毫米)......

在第一页之后的页面中,statis内容和模板块溢出......

有些人可以指导我解决此问题。

<fo:page-sequence master-reference="simpleA5">
                <fo:static-content flow-name="xsl-region-before">
                    <fo:block-container width="297mm" height="25mm"
                        background-color="#DCDCDC">

                        <fo:block margin-left="5mm" margin-top="5mm"
                            margin-right="2mm">
                            <fo:table>
                                <fo:table-column column-width="35mm" />
                                <fo:table-column column-width="25mm" />
                                <fo:table-column column-width="40mm" />
                                <fo:table-column column-width="40mm" />
                                <fo:table-column column-width="50mm" />
                                <fo:table-column column-width="25mm" />
                                <fo:table-column column-width="70mm" />
                                <fo:table-body>
                                    <fo:table-row>
                                        <fo:table-cell>
                                            <fo:block>
                                                <fo:leader leader-length="3.5cm" leader-pattern="rule"
                                                    rule-style="solid" rule-thickness="0.06cm" />
                                                <fo:block>
                                                    <fo:inline font-size="10pt">
                                                        Réconcilation
                                                        comptable
                                                    </fo:inline>
                                                </fo:block>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell>
                                            <fo:block>
                                                <fo:leader leader-length="2cm" leader-pattern="rule"
                                                    rule-style="solid" rule-thickness="0.06cm" />
                                                <fo:block>
                                                    <fo:inline font-size="10pt">
                                                        Annexes
                                                    </fo:inline>
                                                </fo:block>
                                            </fo:block>
                                        </fo:table-cell>
                                    </fo:table-row>
                                </fo:table-body>
                            </fo:table>
                        </fo:block>
                    </fo:block-container>
                </fo:static-content>
                <fo:flow flow-name="xsl-region-body" border-collapse="collapse"
                    reference-orientation="0">
                    <xsl:call-template name="ResultTech" />

                </fo:flow>
            </fo:page-sequence>

模板是这样的。

<xsl:template name='ResultTech'>
        <fo:block page-break-before="always" margin-top="30mm"
            ........
        </fo:block>
</xsl:template>

1 个答案:

答案 0 :(得分:1)

将保证金放在fo:region-body上,而不是fo:block

有关如何使用XSL-FO的指南,请参阅https://www.antennahouse.com/antenna1/comprehensive-xsl-fo-tutorials-and-samples-collection/上的“综合XSL-FO教程和示例集合”和{{3}处的“如何为XML转换为XSL-FO转换样式表” }。