xsl-list
[Top] [All Lists]

Re: unknown number of columns...

2004-02-12 08:01:26
David Carlisle wrote:

can i say, that if a specific number of columns are open (or if the end of the sitewidth is arrived...), make a "break" , make a new site, and show the rest of the columns on the next site?

That's not the xsl way of thinking about it (adding a break part way
through a loop)

Of course splitting a table vertiacally gets interesting if the source
may have spanning cels but assuming that isn't the case (and assuming
you want $n columns per table) you just want to select your inventorlist
elements in groups of $n.

For the first of each group: start a table, start a row, and process the
rest of the group.

so
<xsl:for-each select="inventorlist[position() mod $n = 1">
<fo:table>...
<fo:table-head>..
<fo:table-body>...
<fo:table-row>
<xsl:for-each select=".|following-sibling::inventorlist[position()&lt;$n">
 <fo:table-cell...
</xsl:for-each>


so if you have 21 columns and n is 10 you'll end up with two tables with
10 columns and one with 1, which is, I think your request?

Note you never need to break out of the loop, you just ensure before
starting the loop that you have the correct number of nodes.

David

this works very fine, but i've 2 problems now:
the problem is, that after beginning a new table the position() seems to reset to 0 -> well, i have in the table-header as title the current positio, n= 5, in the first table, the titles are 1-5, so far so good then there comes the new table, and the title is 1-5 again, but should be 6-10 and so on...
oh man, thats difficult to explain ;).

the second question is. how can i tell it to begin on a new page after each table?

thx 4 helping




--
Herwig Posedu

unycom Information Technology Services GmbH
Schmiedlstrasse 1/III
A-8042 Graz

Tel: ++43/316/818828-19
Fax: ++43/316/818828-38

herwig(_dot_)posedu(_at_)unycom(_dot_)com
www.unycom.com




XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>