This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Filling table cells with <item>s


I have to format n <item>s into a set of table cells:

<root>
<item>item01</item>
<item>item02</item>
...
<item>item14</item>
<item>item15</item>
</root>

If each table must have nrows and ncols, then a total of

  ntables=ceiling(n/(nrows*ncols))

tables are necessary to exhaust all of the <item>s with the
last table possibly having some empty cells. For example
if n=15, nrows=3 and ncols=2, ntable=3 and the three tables
would be arranged one after the other as follows:

   +------+------+
   |item01|item02|
   +------+------+
   |item03|item04|
   +------+------+
   |item05|item06|
   +------+------+

   +------+------+
   |item07|item08|
   +------+------+
   |item09|item10|
   +------+------+
   |item11|item12|
   +------+------+

   +------+------+
   |item13|item14|
   +------+------+
   |item15|      |
   +------+------+
   |      |      |
   +------+------+

Also, I would like the option to fill the tables up by
rows (as shown above) or by columns:

   +------+------+
   |item01|item04|
   +------+------+
   |item02|item05|
   +------+------+
   |item03|item06|
   +------+------+

How would you go about implementing this in XSLT given
parameters nrows, ncols, by={"cols","rows"}? I am having
some trouble determining what my "outer" loop is since there
is the possibility of some empty cells (I can't just process
each <item>). Thx in advance.


_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]