Herong's Tutorial Notes On XSL-FO and XHTML
Dr. Herong Yang, Version 2.00

XSL-FO - Lists and Tables

Part:   1   2 

This tutorial helps you to understand:

  • "list-block" Statements
  • "table-and-caption" Statements
  • "leader" Statements

"list-block" Statements

"list-block": An XSL-FO element serving as an action statement to generate one block area with list of pairs of list label and list item.

<fo:list-block provisional-distance-between-starts="1.0in"
 provisional-label-separation="0.1in">
 <fo:list-item>
  <fo:list-item-label start-indent="0.1in">
  symbol or label
  </fo:list-item-label>
  <fo:list-item-body start-indent="1.5in" end-indent="0.1in">
  text
  </fo:list-item-body>
 </fo:list-item>
 ...
</fo:list-block>

Note that:

  • A list block is made of list item areas. And there are two sub areas in each list item area: label area and body area.
  • The provisional-distance-between-starts="1.0in" attribute specifies the distance from the start edge of the label area to the start edge of the body area.
  • The provisional-label-separation="0.1in" attribute specifies the distance from the end edge of the label area to the start edge of the body area.
  • The start-indent="0.1in" attribute is used for the label area to give extra indention for a specific list item.
  • The start-indent="1.5in" attribute specifies the distance from the start edge of the list block area to the start edge of the body area.

The following FO file, list.fo, shows how to use list-block statements:

<?xml version="1.0" encoding="utf-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
 <fo:layout-master-set>
  <fo:simple-page-master master-name="page" margin="1in">
   <fo:region-body/>
  </fo:simple-page-master>
 </fo:layout-master-set>
 <fo:page-sequence master-reference="page">
  <fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:list-block>
 <fo:list-item>
  <fo:list-item-label>
   <fo:block>Term 1</fo:block>
  </fo:list-item-label>
  <fo:list-item-body start-indent="1.0in">
   <fo:block>Description 1</fo:block>
  </fo:list-item-body>
 </fo:list-item>
 <fo:list-item>
  <fo:list-item-label>
   <fo:block>Term 2</fo:block>
  </fo:list-item-label>
  <fo:list-item-body start-indent="1.0in">
   <fo:block>Description 2</fo:block>
  </fo:list-item-body>
 </fo:list-item>
</fo:list-block>
</fo:block>
  </fo:flow>
 </fo:page-sequence>
</fo:root>

Note that:

  • The provisional_* attributes is not used in list-block statement, because it doesn't do anything with FOP.
  • start-indent="1.0in" is used in list-item-body to push the body area to go beyond the label area.

"table-and-caption" Statements

"table-and-caption": An XSL-FO element serving as an action statement to generate one block area with a table and its caption.

<fo:table-and-caption caption-side="after">
 <fo:table-caption>
  caption text
 </fo:table-caption>
 <fo:table>
  <fo:table-header>
   cells in the header
  </fo:table-header>
  <fo:table-footer>
   cells in the footer
  </fo:table-footer>
  <fo:table-column>
  </fo:table-column>
  ...
  <fo:table-body>
   <fo:table-row>
    <fo:table-cell>
     text of the cell
    </fo:table-cell>
    ...
   </fo:table-row>
   ...
  </fo:table-body>
 </fo:table>
</fo:table-and-caption>

(Continued on next part...)

Part:   1   2 

Dr. Herong Yang, updated in 2006
Herong's Tutorial Notes On XSL-FO and XHTML - XSL-FO - Lists and Tables