xsl-list
[Top] [All Lists]

Re: [xsl] Creating newspaper columns with fo:table

2006-11-15 12:27:17
Hi Jacqueline,

You can't use fo:table for this purpose.

Use the column-count and column-gap attribute of the fo:region-body element.
If you use the XEP renderer, then you could also use the rx:flow-section
(see http://www.renderx.com/reference.html#Flow_sections)

Cheers,
Jost

---------
Jost Klopfstein
Axos Technologies Inc.
FO template development
Visit us at http://www.axostech.com
For forms use FormMapper: http://www.FormMapper.com


----- Original Message ----- From: "Jacqueline Radebaugh" <jrad(_at_)loc(_dot_)gov>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Wednesday, November 15, 2006 10:53 AM
Subject: [xsl] Creating newspaper columns with fo:table


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(_at_)loc(_dot_)gov


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>