Two column lists?

1. How to get two column lists


How to get two column lists

Nikolai Grigoriev

> Using FOs, I would like to lay out a list into 2 columns so that half
> the list items are in the first column and the remaining are in the
> second column.  Moreover, this should work for an arbitrary number of
> list items.  What is a direct way of coding this in XSL to produce
> FOs?

There's no special for XSL FO, the same HTML trick applies: draw a table of two cells and put the first half of items into the first cell and the rest to the second. Here's an (untested) sample for the last XSL FO draft (2000-03-27):

<xsl:template match="OL">
   <xsl:variable name="threshold" select="(count(LI) + 1) div 2"/>

      <fo:column column-width="..."/> <!-- first column -->
      <fo:column column-width="..."/> <!-- second column -->
            <fo:table-cell> <!-- First column -->
                       select="LI[position() <=threshold]"/>
            <fo:table-cell> <!-- Second column -->
                       select="LI[position() > $threshold]"/>

<xsl:template match="OL/LI">
      <fo:list-item-label end-indent="label-end()">
          <xsl:number format="1."/>
      <fo:list-item-body start-indent="body-start()">