|
Subject: Re: [xsl] dynamic table in report From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 03 Aug 2011 07:17:08 -0400 |
Hi all,
I want to display a table in a pdf-file. The problem is that the number of rows is dynamic. Furthermore the rows form thematic clusters. As an example:
cluster A subcluster A.1 data 1 data 2 data 3 .. subcluster A.2 data i data i+1 ... cluster B subcluster B.1 data j data j+1 ..
The number of rows in each subcluster is dynamicand I want to have a page breaks after a subcluster. That means, if a subcluster does not fit on the currrent page, the whole subcaption-cluster should be on the next page. It is not necessary that each cluster is on the same page, only subcluster. I used for each row a fo:block element and set the keep-with-previous attribute to handle it and it works.
But if there are to many rows in a subcluster, there will be a page overflow, which makes sense. But how can I handle this? If the number of rows in a subcluster is too big, there should be automatically a page break.
Many of my students are surprised that XSL-FO allows many <table-body> constructs within a single <table> and your use-case is an ideal situation in which to take advantage of this.
Simply put each sub-cluster into a separate <table-body> and use keep-together.within-column="always" on that body segment. No other keeps are needed.
I am using Apache FOP 0.95.
I have no idea if the example below works in FOP. It works with three other XSL-FO tools I've tested it with this morning.
<?xml version="1.0" encoding="US-ASCII"?><!--mathis.fo--> <root xmlns="http://www.w3.org/1999/XSL/Format" font-family="Times" font-size="20pt">
<layout-master-set>
<simple-page-master master-name="frame"
page-height="297mm" page-width="210mm"
margin-top="15mm" margin-bottom="15mm"
margin-left="15mm" margin-right="15mm">
<region-body region-name="frame-body"/>
</simple-page-master>
</layout-master-set> <page-sequence master-reference="frame">
<flow flow-name="frame-body" xmlns="http://www.w3.org/1999/XSL/Format">
<block>This is a test</block>
<table>
<table-body keep-together.within-column="always">
<table-row><table-cell><block>Test
1</block></table-cell></table-row>
<table-row><table-cell><block>Test
1</block></table-cell></table-row>
<table-row><table-cell><block>Test
1</block></table-cell></table-row>
<table-row><table-cell><block>Test
1</block></table-cell></table-row>
<table-row><table-cell><block>Test
1</block></table-cell></table-row>
<table-row><table-cell><block>Test
1</block></table-cell></table-row>
<table-row><table-cell><block>Test
1</block></table-cell></table-row>
<table-row><table-cell><block>Test
1</block></table-cell></table-row>
</table-body>
<table-body keep-together.within-column="always">
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
<table-row><table-cell><block>Test
2</block></table-cell></table-row>
</table-body>
</table>
</flow>
</page-sequence>
</root>-- Contact us for world-wide XML consulting & instructor-led training Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Legal business disclaimers: http://www.CraneSoftwrights.com/legal
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] dynamic table in report, Mathis Mörke | Thread | Re: [xsl] dynamic table in report, Mathis Mörke |
| [xsl] dynamic table in report, Mathis Mörke | Date | [xsl] Removing nodes with text cont, Fabien Tillier |
| Month |