Re: [xsl] the fo:block thing

Subject: Re: [xsl] the fo:block thing
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 13 Jan 2003 07:50:35 -0500
At 2003-01-13 12:52 +0200, Matts Isuls wrote:
Just started with fo.

Welcome!


I have this cell in a table. ... The thing is that is always have to use two lines. How do i do this?

This was important for me when developing stylesheets for use with the Universal Business Language (UBL) documents. Each field on the form has a prescribed location and size, yet the information in each field varies, so I couldn't rely on the number of lines of text.


I ended up using a block container within the table-cell. This required me to set the block container to a multiple of the number of lines, but remember that the default line-height is implementation dependent, so I had to then explicitly set the line-height so that my multiplier worked.

In the example below I have font-size="10pt" line-height="1.1" which means that two lines will take up 22pt, so each cell has <block-container height="22pt"> to force a two-line height.

I hope this helps.

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


<flow flow-name="frame-body" font-family="Times" font-size="10pt" line-height="1.1">


  <block>This is a test</block>
  <table>
    <table-column column-width="5cm"/>
    <table-column column-width="5cm"/>
    <table-column column-width="5cm"/>
    <table-body>
      <table-row>
        <table-cell>
          <block-container height="22pt">
            <block>Short line</block>
          </block-container>
        </table-cell>
        <table-cell>
          <block-container height="22pt">
            <block>Short line</block>
          </block-container>
        </table-cell>
        <table-cell>
          <block-container height="22pt">
            <block>Short line</block>
          </block-container>
        </table-cell>
      </table-row>
      <table-row>
        <table-cell>
          <block-container height="22pt">
            <block>A longer line with enough information for two rows.</block>
          </block-container>
        </table-cell>
        <table-cell>
          <block-container height="22pt">
            <block>A longer line with enough information for two rows.</block>
          </block-container>
        </table-cell>
        <table-cell>
          <block-container height="22pt">
            <block>A longer line with enough information for two rows.</block>
          </block-container>
        </table-cell>
      </table-row>
      <table-row>
        <table-cell>
          <block-container height="22pt">
            <block>Short line</block>
          </block-container>
        </table-cell>
        <table-cell>
          <block-container height="22pt">
            <block>Short line</block>
          </block-container>
        </table-cell>
        <table-cell>
          <block-container height="22pt">
            <block>Short line</block>
          </block-container>
        </table-cell>
      </table-row>
      <table-row>
        <table-cell>
          <block-container height="22pt">
            <block>A longer line with enough information for two rows.</block>
          </block-container>
        </table-cell>
        <table-cell>
          <block-container height="22pt">
            <block>A longer line with enough information for two rows.</block>
          </block-container>
        </table-cell>
        <table-cell>
          <block-container height="22pt">
            <block>A longer line with enough information for two rows.</block>
          </block-container>
        </table-cell>
      </table-row>
    </table-body>
  </table>

</flow>


-- Upcoming hands-on in-depth North America: February 3- 7, 2003 XSLT/XPath and/or XSL-FO Europe: February 17-21, 2003

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 (F:-0995)
ISBN 0-13-065196-6                      Definitive XSLT and XPath
ISBN 0-13-140374-5                              Definitive XSL-FO
ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
ISBN 1-894049-10-1              Practical Formatting Using XSL-FO
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc


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



Current Thread