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

Creating newspaper columns with fo:table

Subject: Creating newspaper columns with fo:table
From: "Jacqueline Radebaugh" <jrad@xxxxxxx>
Date: Wed, 15 Nov 2006 13:53:05 -0500
newspaper column size
Dear All:

I am trying to create a two column table in XSL:FO from which data will flow
from column to column onto 10 consecutive pages.

A portion of the XML is:

<characterPositions>
         <characterPosition type="full concise">
            <label>18-19</label>
            <name>Form of composition</name>
            <level>standard</level>
            <value type="concise">
               <label>an</label>
               <name>Anthems</name>
               <level>standard</level>
            </value>
            <value type="concise">
               <label>bd</label>
               <name>Ballads</name>
               <level>standard</level>
            </value>
<!-- There are many, many, many more <value> elements within this
<characterPosition> element ->
    </characterPosition>
</characterPositions>

My XSL-FO code for the table is:

 <xsl:template match="characterPositions" mode="header">
  <fo:block space-before="2em">
   <fo:table table-layout="fixed" width="100%">
    <fo:table-column column-width="100em"/>
    <fo:table-body>
     <fo:table-row>
      <fo:table-cell>
       <fo:block font-weight="bold">
        <xsl:text>Character Positions (008/18-34 and 006/01-17)</xsl:text>
       </fo:block>
      </fo:table-cell>
     </fo:table-row>
    </fo:table-body>
   </fo:table>
   <xsl:variable name="characterPositionCount"
select="count(characterPosition) div 2+1"/>
   <fo:table table-layout="fixed" width="100%">
    <fo:table-column column-width="27em"/>
    <fo:table-column column-width="60em"/>
    <fo:table-body>
     <fo:table-row>
      <fo:table-cell>
       <fo:block>
        <fo:table table-layout="fixed" width="40%">
         <fo:table-column column-width="5em"/>
         <fo:table-column column-width="15em"/>
         <fo:table-column column-width="15em"/>
         <fo:table-column column-width="5em"/>
         <fo:table-body>
          <xsl:for-each
select="characterPosition[position()&lt;$characterPositionCount]">
           <fo:table-row>
            <fo:table-cell>
               <fo:block text-align="left" margin-left="1em">
                <xsl:value-of select="label"/>
               </fo:block>
            </fo:table-cell>
            <fo:table-cell>
               <fo:block text-align="left">
                <xsl:value-of select="name"/>
               </fo:block>
            </fo:table-cell>
           </fo:table-row>
           <fo:table-row>
            <fo:table-cell>
             <xsl:for-each select="value">
              <fo:block margin-left="3em">
               <xsl:value-of select="label"/>
              </fo:block>
             </xsl:for-each>
            </fo:table-cell>
            <fo:table-cell>
             <xsl:for-each select="value">
              <fo:block>
               <xsl:value-of select="name"/>
              </fo:block>
             </xsl:for-each>
            </fo:table-cell>
           </fo:table-row>
          </xsl:for-each>
         </fo:table-body>
        </fo:table>
       </fo:block>
      </fo:table-cell>
      <fo:table-cell>
       <fo:block>
        <fo:table table-layout="fixed" width="40%">
         <fo:table-column column-width="5em"/>
         <fo:table-column column-width="15em"/>
         <fo:table-column column-width="15em"/>
         <fo:table-column column-width="5em"/>
         <fo:table-body>
          <xsl:for-each
select="characterPosition[position()&gt;$characterPositionCount]">
           <fo:table-row>
            <fo:table-cell>
               <fo:block text-align="left" margin-left="1em">
                <xsl:value-of select="label"/>
               </fo:block>
            </fo:table-cell>
            <fo:table-cell>
               <fo:block text-align="left">
                <xsl:value-of select="name"/>
               </fo:block>
            </fo:table-cell>
           </fo:table-row>
           <fo:table-row>
            <fo:table-cell>
             <xsl:for-each select="value">
              <fo:block margin-left="3em">
               <xsl:value-of select="label"/>
              </fo:block>
             </xsl:for-each>
            </fo:table-cell>
            <fo:table-cell>
             <xsl:for-each select="value">
              <fo:block>
               <xsl:value-of select="name"/>
              </fo:block>
             </xsl:for-each>
            </fo:table-cell>
           </fo:table-row>
          </xsl:for-each>
         </fo:table-body>
        </fo:table>
       </fo:block>
      </fo:table-cell>
     </fo:table-row>
    </fo:table-body>
   </fo:table>
   </fo:block>
  <fo:block>
   <fo:leader leader-length="100%" leader-pattern="rule" rule-style="solid"
rule-thickness=".1mm" color="black"/>
  </fo:block>
  </xsl:template>

As you can see, I am using:

<xsl:variable name="characterPositionCount" select="count(characterPosition)
div 2+1"/>

to divide the data into two columns on the page.  However, because of the
great length of data within each <characterPosition> element (this is because
of the amount of <value> elements below <characterPosition>), the list of
<characterPosition><value> elements in the first column continues onto the
next page, instead of streaming onto the second column first.

Ideally, I would like the data to stream from one column to the other before
breaking onto a new page (like "newspaper columns").

Do any of you have any idea what I can do to create this table?

Thank you so very much for all of your help!

Best wishes,






Jackie Radebaugh

Library of Congress
Network Development & MARC Standards Office
Washington, DC
USA
Phone:  +1-202-707-1153
FAX:  +1-202-707-0115
E-Mail:  jrad@xxxxxxx

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.