[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] dynamic table in report


Subject: Re: [xsl] dynamic table in report
From: Mathis Mörke <mathis.moerke@xxxxxxxxxxxxxx>
Date: Fri, 5 Aug 2011 11:21:44 +0200

Thank you for your quick response. I will have a try at it, but I use
MATLAB to create a xml file and then xsl-fo to generate a pdf. I don't
know how to implement your suggestion at the moment.

2011/8/3 G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx>:
> At 2011-08-03 10:14 +0200, Mathis Mvrke wrote:
>>
>> 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.
>
> I think you are approaching this at too low a level.
>
>> 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.
>
> I hope this helps.
>
> . . . . . . . . . . Ken
>
> <?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
Keywords
xml