I have a table which could have n number of rows. The table is present inside a block-container with absolute-position="absolute" so that the table has a fixed position.
Now the number of rows that i need to present on the first is only 5. If in case its more than 5 i need to present the rest in a new page and add a footer in the front page that says continues in next page.
How do i achieve this using XSLT? I am using Apache fop to generate AFP and PDF
Please find below snippet of code that i have written already.
<fo:block-container border="solid 1px" absolute-position="absolute" left="3.09in" top="2.95in" width="4.765in" height="1.1in" overflow="hidden">
<fo:table table-layout="fixed" width="100%">
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block padding-left="2.0mm" padding="2pt" font-family="TelenorTFBold" font-size="11pt" font-weight="normal" fox:border-before-start-radius="5pt" fox:border-before-end-radius="5pt" fox:border-after-start-radius="5pt" fox:border-after-end-radius="5pt" background-color="#f8f8f8">
<xsl:call-template name="LabelText">
<xsl:with-param name="Code" select="concat($language, 'Number')"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block padding-left="2.0mm" padding="2pt" font-family="TelenorTFBold" font-size="11pt" font-weight="normal" fox:border-before-start-radius="5pt" fox:border-before-end-radius="5pt" fox:border-after-start-radius="5pt" fox:border-after-end-radius="5pt" background-color="#f8f8f8">
<xsl:call-template name="LabelText">
<xsl:with-param name="Code" select="concat($language, 'duedate')"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block text-align="right" padding-left="2.0mm" padding="2pt" font-family="TelenorTFBold" font-size="11pt" font-weight="normal" fox:border-before-start-radius="5pt" fox:border-before-end-radius="5pt" fox:border-after-start-radius="5pt" fox:border-after-end-radius="5pt" background-color="#f8f8f8">
<xsl:call-template name="LabelText">
<xsl:with-param name="Code" select="concat($language, 'Total')"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:for-each select="InstallmentPlan">
<fo:table-row>
<fo:table-cell font-family="TelenorTF" font-size="7pt" font-weight="normal">
<fo:block padding-after="0.15cm" white-space-collapse="false">
<xsl:value-of select="InstallmentNumber"/>
</fo:block>
</fo:table-cell>
<fo:table-cell font-family="TelenorTF" font-size="7pt" font-weight="normal">
<fo:block padding-after="0.15cm" white-space-collapse="false">
<xsl:value-of select="DueDate"/>
</fo:block>
</fo:table-cell>
<fo:table-cell font-family="TelenorTF" font-size="7pt" font-weight="normal">
<fo:block text-align="right" padding-after="0.15cm" white-space-collapse="false">
<xsl:call-template name="format_amount">
<xsl:with-param name="amount" select="Amount"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:block-container>
Look and feel of the output :
Page 1:
Number Duedate Total
1 01-08-2024 12345
2 01-09-2024 12344
3 01-07-2024 12345
4 01-06-2024 12345
5 01-03-2024 12345
Continues on next page
Information section
".................."
Page 2:
Number Duedate Total
6 01-08-2024 12345
7 01-09-2024 12344
8 01-07-2024 12345
9 01-06-2024 12345
10 01-03-2024 12345
I won't try to include the XSLT suggestion into your XSL-FO markup but you can positional grouping in XSLT 2/3 e.g. something like