Заголовок таблицы не добавляется на следующую страницу, если содержимое таблицы распространяется на следующую страницу. Заголовок отображается для нескольких таблиц, но если содержимое таблицы распространяется на следующую страницу, тогда заголовок не появляется, и он начинает строку таблицы на следующей странице. Необходимо добавить заголовок перед началом следующей страницы, если содержание таблицы расширяется.
Пример XML:
<NewDataSet>
<DefaultView>
<Department>2222</Department>
<Title>Manish</Title>
</DefaultView>
<DefaultView>
<Department>2222</Department>
<Title>Santosh</Title>
</DefaultView>
<DefaultView>
<Department>2222</Department>
<Title>Naveen</Title>
</DefaultView>
<DefaultView>
<Department>2222</Department>
<Title>punith</Title>
</DefaultView>
<DefaultView>
<Department>2223</Department>
<Title>bharath</Title>
</DefaultView>
<DefaultView>
<Department>2223</Department>
<Title>vijay</Title>
</DefaultView>
<DefaultView>
<Department>2223</Department>
<Title>Manish</Title>
</DefaultView>
<DefaultView>
<Department>2223</Department>
<Title>Santosh</Title>
</DefaultView>
<DefaultView>
<Department>2224</Department>
<Title>Naveen</Title>
</DefaultView>
<DefaultView>
<Department>2224</Department>
<Title>punith</Title>
</DefaultView>
<DefaultView>
<Department>2224</Department>
<Title>bharath</Title>
</DefaultView>
<DefaultView>
<Department>2224</Department>
<Title>vijay</Title>
</DefaultView>
<DefaultView>
<Department>2224</Department>
<Title>Manish</Title>
</DefaultView>
<DefaultView>
<Department>2224</Department>
<Title>Santosh</Title>
</DefaultView>
<DefaultView>
<Department>2224</Department>
<Title>Naveen</Title>
</DefaultView>
<DefaultView>
<Department>2225</Department>
<Title>punith</Title>
</DefaultView>
<DefaultView>
<Department>2225</Department>
<Title>bharath</Title>
</DefaultView>
<DefaultView>
<Department>2225</Department>
<Title>vijay</Title>
</DefaultView>
<DefaultView>
<Department>2225</Department>
<Title>Manish</Title>
</DefaultView>
<DefaultView>
<Department>2225</Department>
<Title>Santosh</Title>
</DefaultView>
<DefaultView>
<Department>2226</Department>
<Title>Naveen</Title>
</DefaultView>
<DefaultView>
<Department>2226</Department>
<Title>punith</Title>
</DefaultView>
<DefaultView>
<Department>2226</Department>
<Title>bharath</Title>
</DefaultView>
<DefaultView>
<Department>2226</Department>
<Title>vijay</Title>
</DefaultView> <DefaultView>
<Department>2226</Department>
<Title>Manish</Title>
</DefaultView>
<DefaultView>
<Department>2226</Department>
<Title>Santosh</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>Naveen</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>punith</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>bharath</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>vijay</Title>
</DefaultView> <DefaultView>
<Department>2227</Department>
<Title>Manish</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>Santosh</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>Naveen</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>punith</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>bharath</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>vijay</Title>
</DefaultView> <DefaultView>
<Department>2227</Department>
<Title>Manish</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>Santosh</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>Naveen</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>punith</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>bharath</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>vijay</Title>
</DefaultView> <DefaultView>
<Department>2227</Department>
<Title>Manish</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>Santosh</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>Naveen</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>punith</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>bharath</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>vijay</Title>
</DefaultView> <DefaultView>
<Department>2227</Department>
<Title>Manish</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>Santosh</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>Naveen</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>punith</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>bharath</Title>
</DefaultView>
<DefaultView>
<Department>2227</Department>
<Title>vijay</Title>
</DefaultView>
</NewDataSet>
Образец XSL:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:rx="http://www.renderx.com/XSL/Extensions"
xmlns:psmi="http://www.CraneSoftwrights.com/resources/psmi"
xmlns:exsl="http://exslt.org/common">
<xsl:template match='NewDataSet'>
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="my-page">
<fo:region-body margin="1in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="my-page">
<fo:flow flow-name="xsl-region-body">
<xsl:for-each select="*">
<xsl:variable name="tempdept">
<xsl:value-of select="Department" />
</xsl:variable>
<xsl:variable name="dept">
<xsl:value-of select="preceding-sibling::DefaultView[1]/Department" />
</xsl:variable>
<xsl:if test="$dept != $tempdept" >
<xsl:call-template name="header"/>
</xsl:if>
<fo:table-and-caption>
<fo:table rx:table-omit-initial-header="true">
<fo:table-column column-width="25mm"/>
<fo:table-column column-width="25mm"/>
<fo:table-header keep-together="always">
<fo:block text-align="center" font-style="italic" margin="5pt" keep-together="always">
<xsl:text>Table (Cont.)</xsl:text>
</fo:block>
</fo:table-header>
<fo:table-header >
<fo:table-row>
<fo:table-cell border-color="black" border-style="solid" width = "85pt" border-width="0.4pt" padding="3pt" align="left">
<fo:block font-weight="bold">Dept</fo:block>
</fo:table-cell >
<fo:table-cell border-color="black" border-style="solid" width = "85pt" border-width="0.4pt" padding="3pt" align="left">
<fo:block font-weight="bold">Title</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<fo:table-row>
<fo:table-cell border-color="black" border-style="solid" width = "85pt" border-width="0.4pt" padding="3pt" align="left">
<fo:block>
<xsl:value-of select="Department"/>
</fo:block>
</fo:table-cell>
<fo:table-cell border-color="black" border-style="solid" width = "85pt" border-width="0.4pt" padding="3pt" align="left">
<fo:block>
<xsl:value-of select="Title"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:table-and-caption>
</xsl:for-each>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template name='header'>
<fo:table>
<fo:table-column column-width="25mm"/>
<fo:table-column column-width="25mm"/>
<fo:table-header keep-together="always">
<fo:block text-align="center" font-style="italic" margin="5pt" keep-together="always">
<xsl:text>Table</xsl:text>
</fo:block>
</fo:table-header>
<fo:table-header >
<fo:table-row>
<fo:table-cell border-color="black" border-style="solid" width = "85pt" border-width="0.4pt" padding="3pt" align="left">
<fo:block font-weight="bold">Dept</fo:block>
</fo:table-cell >
<fo:table-cell border-color="black" border-style="solid" width = "85pt" border-width="0.4pt" padding="3pt" align="left">
<fo:block font-weight="bold">Title</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
</fo:table>
</xsl:template>
</xsl:stylesheet>
Пример скриншота O / P:
1. С несколькими таблицами:
Заголовок таблицы с несколькими таблицами
2. Заголовок не приходит, если содержимое таблицы распространяется на следующую страницу:
Заголовок не появляется, если содержимое таблицы распространяется на следующую страницу