|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: two column list using FOs?
Philip Marden wrote:
> 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:table>
<fo:column column-width="..."/> <!-- first column -->
<fo:column column-width="..."/> <!-- second column -->
<fo:table-body>
<fo:table-row>
<fo:table-cell> <!-- First column -->
<fo:list-block>
<xsl:apply-templates
select="LI[position() <=threshold]"/>
</fo:list-block>
</fo:table-cell>
<fo:table-cell> <!-- Second column -->
<fo:list-block>
<xsl:apply-templates
select="LI[position() > $threshold]"/>
</fo:list-block>
</fo:table-cell>
</fo:table-row>
<fo:table-body>
</fo:table>
</xsl:template>
<xsl:template match="OL/LI">
<fo:list-item>
<fo:list-item-label end-indent="label-end()">
<xsl:number format="1."/>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<xsl:apply-templates/>
</fo:list-item-body>
</fo:list-item>
</xsl:template>
Regards,
Nikolai Grigoriev
RenderX
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








