Re: Implementing a multi-column list

Cindy Hunt wrote:

> I wanted to see if anyone has done something similar to this and offer implementation suggestions. In our DTD, we have a list type that allows the user to specify the number of columns that they would like the list to format in via an attribute on the list element. The list then contains a series of 2 or more items that are just PCDATA.
> 
> Basically, I need to count the number of items in the list and divide it by the number of columns they specified. The items should then fill each column from top to bottom and then any remainders would be placed in the last column.
> 
> For example if the list contained 5 items and the user specified they wanted 3 columns it would look like so:
> 
> item 1	item 3	item 5    
> item 2	item 4
> 
> Or if the list contained 5 items and the user specified they wanted 2 columns it would look like so:
> 
> item 1	item 4
> item 2	item 5
> item 3

Have you considered native declarative xsl-fo solution? Just declare how much 
columns you want on a region-body and let your favorite formatter to format 
your items appropriatively.

<fo:region-body column-count="{$user-defined-number-of-columns}" 
column-gap="10pt"/>

See
1. spec:
http://www.w3.org/TR/xsl/slice6.html#fo_region-body
2. example:
"Multi-Column Regions" example at http://www.renderx.com/testcases.html.

-- 
Oleg Tkachenko
eXperanto team
Multiconn Technologies, Israel

Received on Tuesday, 3 December 2002 11:46:47 UTC