繁体   English   中英

带有重复标题的XSL-FO表

[英]XSL-FO Table with repeating headers

我会尽力解释这个......

我正在使用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>

你能这样试试吗? 如果这仍然不起作用,您是否也可以附加数据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>

编辑:只是格式化

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM