XSL-FO带有重复表头的表格

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

编辑:只是格式化

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接