Table concepts

In this example the table concepts of HTML, CALS and XSL-FO are compared.

With the comparison of the table concepts of HTML and CALS on the one hand as well as XSL-FO on the other hand, the transformation of the table structures shall be simplified and typical problems shall be pointed out.

In the following table elements of CALS, HTML and XSL-FO are compared. So, the similarities and differences can be quickly overviewed.

- <table> <fo:table-and-caption>
<caption> <caption> <fo:table-caption>
<table> <tgroup> <fo:table>
<col> <colspec> <fo:table-column>
<thead> <thead> <fo:table-header>
<tfoot> <tfoot> <fo:table-footer>
<tbody> <tbody> <fo:table-body>
<tr> <row> <fo:table-row>
<td>, <th> <entry> <fo:table-cell>

In this example potential sources of errors are pointed out because there is a large number of valid attributes for each of these elements which may also be used at different levels of the table structure and because the default values in HTML and CALS are often unclear. Of course, the listing of these possible sources of errors is not complete.

  • Headlines and captions: In XSL-FO tables with a table headline or a caption have to begin with the <table-and-caption> element. Without such a headline or caption, the table begins with <table>.

  • CALS <tgroup>: Corresponds in XSL-FO to <fo:table>.

  • HTML <tbody>: The element can be omitted if the table only has one sequence of table rows (<tr>). In this case the rows of a table have to be embedded in <fo:table-body>.

  • Structures in table cells: In HTML as well as in CALS tables, simple character data is valid within the table cells. In <fo:table-cell> the contents have to be embedded in a block.

  • Anticipated column specifications: In HTML <col> is used for it (but seldom), in CALS <colspec> is used and in XSL-FO <fo:table-column>. Since these specifications, viewed from the table cells, do not lie on a direct upward axis of the structure, it is recommended to transform the relevant specifications in HTML and CALS into the corresponding XSL-FO construct. The XSL formatter reads from it the information being relevant for the column dimensioning during the formatting process of the table cells. Please note that in XSL-FO the specification has to get a number (column-number) for each column which has to be referenced in each cell.

  • Spanning of columns (horizontal spanning): In old versions of the CALS table structure a concept (<spanspec>) corresponding to the <col-spec> is used for the spanning of columns. For CALS tables is recommended to only rely on the simplified exchange table model. If the horizontal spanning is specified at cell-level, the transformation of the spanning information from HTML or CALS (colspan) to XSL-FO (number-columns-spanned) will be unproblematic.

  • Spanning of cells (vertical spanning): Each spanning is specified in all three concepts in the table cells. In CALS the attribute is called morerows. The default value is unclear. In practice the value 1 should correspond to a spanning of two rows. In HTML (rowspan) and XSL-FO (number-rows-spanned) the value 1 does not correspond to a spanning of rows.

  • Vertical alignment in table cells: The valign attribute in HTML and CALS generallly corresponds to the display-align attribute in XSL-FO. In XSL-FO the latter attribute is only valid on a cell level, in HTML and CALS also on the higher levels of the table for all cells which are below the node.

  • Horizontal alignment in table cells: The align attribute in HTML and CALS for the horizontal alignment of the contents in table cells has no equivalent on the same structure level in the XSL-FO table structure. In XSL-FO the horizontal alignment in the table cell has to be bound to the block which encloses the cell content.


<< back next >>

Copyright © dpunkt.verlag GmbH 2004
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSL-FO in der Praxis" ("XSL-FO in practice") is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.

dpunkt.verlag GmbH, Ringstraße 19B, 69115 Heidelberg, fon 06221-14830, fax 06221-148399,