[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: two column list using FOs?

Subject: Re: two column list using FOs?
From: "Nikolai Grigoriev" <grig@xxxxxxx>
Date: Thu, 4 May 2000 00:36:14 +0400
html two column list
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() &lt;=threshold]"/>
               </fo:list-block>
            </fo:table-cell>
            <fo:table-cell> <!-- Second column -->
               <fo:list-block>
                  <xsl:apply-templates 
                       select="LI[position() &gt; $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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.