iwasaki
iwasaki

Reputation: 77

How to add a continued label in a static table with XSL/XSL-FO?

I am using an xml data similar to the sample below. There is a list of possible risks, and each of them can have a name and a description.

<risks>
    <freezeDeductible name="item1" description="desc 1"/>
    <moneySecLimit name="item2" description="desc 2"/>
    <unscheduledLimit name="item3" description="desc 3"/>
    ...
</risks>

The structure of my template looks as below:

<xsl:template name="displayRisks">
    <fo:block>

        <fo:table>
            <fo:table-column column-width="proportional-column-width(33.333)" column-number="1"/>
            <fo:table-column column-width="proportional-column-width(33.333)" column-number="2"/>
            <fo:table-column column-width="proportional-column-width(33.333)" column-number="3"/>
            <fo:table-body>
                <fo:table-row>
                    <fo:table-cell>
                        <fo:block font-weight="bold">ALL RISKS</fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block><xsl:value-of select="/risks/freezeDeductible/@name"/></fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block><xsl:value-of select="/risks/freezeDeductible/@description"/></fo:block>
                    </fo:table-cell>
                </fo:table-row>
                <fo:table-row>
                    <fo:table-cell>
                        <fo:block> </fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block><xsl:value-of select="/risks/moneySecLimit/@name"/></fo:block>
                    </fo:table-cell>
                    <fo:table-cell>
                        <fo:block><xsl:value-of select="/risks/moneySecLimit/@description"/></fo:block>
                    </fo:table-cell>
                </fo:table-row>
            </fo:table-body>
        </fo:table>
    </fo:block>
</xsl:template>

From the above template, I am generating PDF outputs. Because of the risk description size, and the number of risks elements is unknown, the table can go over multiple one or pages.

On the column1 x row1, there is displayed on first page, the title - "ALL RISKS". It needs to be on the same line as first risk name and description, so cannot move it to the table-header.

Is there any way that, when the table gets to page2, page3, etc. , to display the title (ALL RISKS) on the first row of the new page, with a label - for example: (continue..) ?

For example: Page1: should display the title, on first table-row, as follows: ALL RISKS

If there is a Page2: display the title on the first table-row on Pag2, as follows: ALL RISKS(continued..)

Thanks!

Upvotes: 0

Views: 301

Answers (1)

Tony Graham
Tony Graham

Reputation: 8068

There is an fo:retrieve-table-marker example in the 'XSL-FO Samples Collection' at https://www.antennahouse.com/xsl-fo-samples#table-retrieve-table-marker-1. (You may need to scroll up after you follow the link because of the banner on the page.)

There's also an example of the axf:repeat-content-at-break and axf:table-cell-repeated-marker AH Formatter extensions at https://www.antennahouse.com/xsl-fo-samples#axf-table-cell-repeated-marker-1 that demonstrates both the repetition and a '(Continued)' marker like what you want.

Upvotes: 1

Related Questions