gpt4 book ai didi

xml - 具有重复标题的 XSL-FO 表

转载 作者:数据小太阳 更新时间:2023-10-29 02:46:11 28 4
gpt4 key购买 nike

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

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

这是 header 的 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>

编辑:只是格式化

关于xml - 具有重复标题的 XSL-FO 表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10175674/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com