Re: [xsl] Balancing Columns

Subject: Re: [xsl] Balancing Columns
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 24 Jan 2002 10:24:21 -0500
At 2002-01-24 08:59 -0600, W. Eliot Kimber wrote:
"G. Ken Holman" wrote:
>
> At 2002-01-23 11:42 -0600, W. Eliot Kimber wrote:
> >Is there a way to get balanced columns in a multi-column page layout?
>
> Columns in a page are always balanced, in that the simple page geometry
> only provides for a column count and a column gap ... thus, the column
> widths are always equal.

I think you've misunderstood what I mean by "balanced columns".

Yup! Sorry 'bout that.


I don't
mean columns of equal width, but columns in which the composed text is
of equal depth across the columns, e.g.:


xxxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxxx xxxxxxxxxx

Not:

     xxxxxxxxxxx      xxxxxxxxxx
     xxxxxxxxxxx
     xxxxxxxxxxx
     xxxxxxxxxxx

Wouldn't you just do that in your transformation, choosing to put whatever text you want in each column based on the count?


I did this on pages 286-314 of the property summary where each entry has between 5 and 6 lines in the XSLFO specification: I used a two-column table row populated roughly like:

  <xsl:variable name="items" select="...whatever..."/>
  <table>
    <table-row>
      <table-cell>
        <xsl:for-each select="$items">
          <xsl:if test="position() &lt;= ( last() / 2 )">
            <!--format item in left-hand column-->
          </xsl:if>
        </xsl:for-each>
     </table-cell>
      <table-cell>
        <xsl:for-each select="$items">
          <xsl:if test="position() > ( last() / 2 )">
            <!--format item in right-hand column-->
          </xsl:if>
        </xsl:for-each>
     </table-cell>
   </table-row>
 </table>

Note, though, that the "weighting" of each line is not accommodated in the balancing ... this would be a formatter task and not a transformation task and is not available in XSLT 1.0 (would probably be related to synchronization objects that don't exist yet). This is why my bullet counts in each column are balanced but the column heights are not balanced.

Since you do say "composed text" to be balanced, I would assume the above is insufficient and that the synchronization stuff you need is not yet available to you.

Sorry, Eliot, for misinterpreting your need.

................ Ken


-- Upcoming: 3-days XSLT/XPath and/or 2-days XSLFO - Feb 18-22, 2002

G. Ken Holman                mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995)
ISBN 0-13-065196-6                        Definitive XSLT & XPath
ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
ISBN 1-894049-07-1               Practical Formatting Using XSLFO
XSL/XML/DSSSL/SGML/OmniMark services, books(electronic, printed),
articles, training(instructor-live,Internet-live,web/CD,licensed)
Next public training:  02-02-11,12,14,15,18,21,03-04,05,06,08,11,
-                                04-08,09,10,12,05-14,15,06-04,07


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread