4

我会尽力解释这一点...

我正在使用 XML 和 XSL-FO 生成 PDF。该文档有两列带有表头。我想让表格标题只在到达新页面时重复。它目前正在这样做,但是当表格标题到达另一列时,表格标题也会重复。我只希望它在不同的页面上重复。任何帮助将不胜感激。

这是标头的 XSL:

<xsl:template match="MAJOR">
    <fo:table rx:table-omit-initial-header="true" width="95%">

        <fo:table-column/>
        <fo:table-header>
            <fo:table-row keep-with-next="always">
                <fo:table-cell>
                    <fo:block font-family="Times New Roman" font-size="8pt" font-weight="bold"><xsl:value-of select="@NAME"/>--Cont'd</fo:block>
                </fo:table-cell>
                <fo:table-cell><fo:block/></fo:table-cell>
            </fo:table-row>
        </fo:table-header>

        <fo:table-body>
            <fo:table-row keep-with-next="always">
                <fo:table-cell>
                    <fo:block font-family="Times New Roman" font-size="8pt" font-weight="bold"><xsl:value-of select="@NAME"/></fo:block>
                </fo:table-cell>
                <fo:table-cell><fo:block/></fo:table-cell>
            </fo:table-row>
            <xsl:apply-templates/>
        </fo:table-body>
    </fo:table>
</xsl:template>
4

1 回答 1

1

你可以这样试试吗?如果这仍然不起作用,您能否附上数据 xml 文件?

  <xsl:template match="/">
        <fo:table rx:table-omit-initial-header="true" width="95%">
            <fo:table-column/>
                <fo:table-header>
                    <fo:table-row keep-with-next="always">
                        <fo:table-cell>
                            <fo:block font-family="Times New Roman" font-size="8pt" font-weight="bold"><xsl:value-of select="@NAME"/>--Cont'd</fo:block>
                        </fo:table-cell>
                        <fo:table-cell><fo:block/></fo:table-cell>
                    </fo:table-row>
                </fo:table-header>

                <fo:table-body>
                    <xsl:for-each select="MAJOR">
                    <fo:table-row keep-with-next="always">
                        <fo:table-cell>
                            <fo:block font-family="Times New Roman" font-size="8pt" font-weight="bold"><xsl:value-of select="@NAME"/></fo:block>
                        </fo:table-cell>
                        <fo:table-cell><fo:block/></fo:table-cell>
                    </fo:table-row>
                </xsl:for-each>
            </fo:table-body>
        </fo:table>
    </xsl:template>

编辑:只是格式化

于 2014-10-22T12:59:13.950 回答