You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Joerg Pietschmann <jo...@zkb.ch> on 2002/03/21 17:36:50 UTC

Re: Subject: text colums

Lauren Commons <lh...@yahoo.com> wrote:
> I am producing pdfs that will have a bullet list that
> I want to display in two columns, like newspaper
> columns.  I won't know in advance how many items will
> be in the list.

I suppose you have
...
  <li>Item1</li>
  <li>Item2</li>
  <li>Item3</li>
...
and want to display
  o Item1         o Item3
  o Item2
or perhaps
  o Item1         o Item2
  o Item3
(note the difference)

This is not easy to achieve. A first shot would be to use
a two column table distribute the list items equally between
the columns. You have also to decide whether you want to use
one row in the table or a row for every pair of items.
A sample XSLT snippet (untested):
  <fo:table table-layout="fixed">
    <fo:table-column column-width="proportional-column-width()"/>
    <fo:table-column column-width="proportional-column-width()"/>
    <fo:table-body>
      <fo:table-row>
        <xsl:for-each select="li[position() div 2=0]">
          <fo:table-cell>
            <xsl:apply-templates>
          </fo:table-cell>
          <fo:table-cell>
            <xsl:apply-templates select="following-sibling:li">
          </fo:table-cell>
        </xsl:for-each>
      </fo:table-row>
    </fo:table-body>
  </fo:table>
This will generate the secont variant, with one row. If you want
multiple rows, move the <fo:table-row> into the xsl:for-each
The first variant is a bit harder to get.

Whether the table solution matches your expectations is up to
you. Having two columns with items flowing from the first
to the second column to fill a minimal area seems to be much
harder unless you want to have the whole page in two columns.

Ask on the XSL list for more ideas.

J.Pietschmann

Re: Subject: text colums

Posted by Lauren Commons <lh...@yahoo.com>.
I think this will probably work fine.  Thanks for the
ideas.


--- Joerg Pietschmann <jo...@zkb.ch>
wrote:
> Lauren Commons <lh...@yahoo.com> wrote:
> > I am producing pdfs that will have a bullet list
> that
> > I want to display in two columns, like newspaper
> > columns.  I won't know in advance how many items
> will
> > be in the list.
> 
> I suppose you have
> ...
>   <li>Item1</li>
>   <li>Item2</li>
>   <li>Item3</li>
> ...
> and want to display
>   o Item1         o Item3
>   o Item2
> or perhaps
>   o Item1         o Item2
>   o Item3
> (note the difference)
> 
> This is not easy to achieve. A first shot would be
> to use
> a two column table distribute the list items equally
> between
> the columns. You have also to decide whether you
> want to use
> one row in the table or a row for every pair of
> items.
> A sample XSLT snippet (untested):
>   <fo:table table-layout="fixed">
>     <fo:table-column
> column-width="proportional-column-width()"/>
>     <fo:table-column
> column-width="proportional-column-width()"/>
>     <fo:table-body>
>       <fo:table-row>
>         <xsl:for-each select="li[position() div
> 2=0]">
>           <fo:table-cell>
>             <xsl:apply-templates>
>           </fo:table-cell>
>           <fo:table-cell>
>             <xsl:apply-templates
> select="following-sibling:li">
>           </fo:table-cell>
>         </xsl:for-each>
>       </fo:table-row>
>     </fo:table-body>
>   </fo:table>
> This will generate the secont variant, with one row.
> If you want
> multiple rows, move the <fo:table-row> into the
> xsl:for-each
> The first variant is a bit harder to get.
> 
> Whether the table solution matches your expectations
> is up to
> you. Having two columns with items flowing from the
> first
> to the second column to fill a minimal area seems to
> be much
> harder unless you want to have the whole page in two
> columns.
> 
> Ask on the XSL list for more ideas.
> 
> J.Pietschmann


=====
-------------------------
Mr Lauren Commons
DISCLAIMER: The opinions expressed 
ARE in fact those of my employer.

__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards�
http://movies.yahoo.com/