Part II(d): Tables

Structure Guidelines for DAISY/NISO
Last Revised: September 10, 2005

This section of the guidelines explain the elements used to mark up straightforward tables. For information on tagging more complex tabular material, see the "Tables" section of the DTBook DTD, the XHMTL1.1 specification, from which the table model is drawn, or applicable reference works.

Information Object: Tables

Definition: A table is an arrangement of data with two or more columns and one or more rows in which the information in the leftmost column relates specifically to the information in the other column or columns. The format of a table may vary depending on the project style. A table usually has column headings and may or may not have a title.

Tables normally read across from left to right, that is, information in the right columns relates horizontally to the information in the left columns.

Bibliographic Reference

Markup: Tables are marked up using the <table> element in combination with the <caption>, <thead> (header), optional <tbody> (main body of table), <tr> (table row), <th> (cell containing header information), and <td> (cell containing table data) elements. The <tfoot> tag can be used to add footer information. In addition, <col> defines the alignment properties for cells in one or more columns and <colgroup> groups adjacent columns that are semantically related.

The <table> tags surround the entire table. Certain optional elements, if used, must follow in this sequence: <caption>, either <col> or <colgroup>, <thead>, and <tfoot>. Any or all of these elements may be used. The content of the table, in the tbody element, follows. In simple tables, <tr> marks each row of table data cells (<td>). In tables consisting of multiple sections, <tbody> marks each section and contains one or more rows (<tr>).

The <thead> and <tfoot> elements contain table header and footer information, respectively, in rows <tr> of cells (usually <th>). Each, if used, may be used only once, but applies to all sections (<tbody>) of the table. Browsers and playback devices can duplicate headers and footers when breaking a table across page boundaries, or present them statically when sections are rendered in a scrolling panel.

A long table spanning several pages of the print book should have separate <pagenum> values for each of the pages on which the table appears. A <prodnote> explaining that the table spans several pages should be added prior to the table.

Syntax:


<table>...</table>

<caption>...</caption>

<col>...</col>

<colgroup>...</colgroup>

<thead>...</thead>

<tfoot>...</tfoot>

<tbody>...</tbody>

<tr>...</tr>

<th>...</th>

<td>...</td>

Example 1 shows a very simple table with no caption, footer, nor <tbody>:


<table border="1">

  <thead>

    <tr>

      <th>Parent Company</th>

      <th>Divested Business</th>

    </tr>

  </thead>

  <tr>

    <td>U.S. Sprint</td>

    <td>Cellular phone</td>

  </tr>

  <tr>

    <td>Union Pacific</td>

    <td>Oil, gas</td>

  </tr>

  <tr>

    <td>Viacom</td>

    <td>Cable TV</td>

  </tr>

</table>

This table would be rendered as:

Parent Company Divested Business
U.S. Sprint Cellular phone
Union Pacific Oil, gas
Viacom Cable TV

Example 2:


<table border="1">

  <caption>This table contains both a header and a footer.</caption>

  <thead>

    <tr>

      <th>Number</th>

      <th>A</th>

      <th>B</th>

      <th>C</th>

    </tr>

  </thead>

  <tfoot>

    <tr>

      <th>Footer Number</th>

      <th>Footer A</th>

      <th>Footer B</th>

      <th>Footer C</th>

    </tr>

  </tfoot>

  <tbody>

    <tr>

      <td>1</td>

      <td>A1</td>

      <td>B1</td>

      <td>C1</td>

    </tr>

    <tr>

      <td>2</td>

      <td>A2</td>

      <td>B 2</td>

      <td>C2</td>

    </tr>

    <tr>

      <td>3</td>

      <td>A3</td>

      <td>B3</td>

      <td>C3</td>

    </tr>

  </tbody>

</table>

    

This table would be rendered as:

This table contains both a header and a footer.
Number A B C
Footer Number Footer A Footer B Footer C
1 A 1 B 1 C 1
2 A 2 B 2 C 2
3 A 3 B 3 C 3

Example 3 below shows a table that spans three pages can be set up. Page numbers may not occur within a table.

Example 3:


<pagenum id="pg255" page="normal">255</pagenum>

<prodnote render="required">The following table spans pages 255 to 257. It is recorded in its entirety on page 255. Text.</prodnote>



<table border="1">

<caption>This table contains a header and a footer.</caption>

    <thead>

    ...

    </thead> 

    

    <tbody>

    ...

    </tbody>

</table>



<pagenum id="pg256" page="normal">256</pagenum>

<prodnote render="required">Producer's Note: This page contains Table XXX, which 

    has been produced on page 255.</prodnote>



<pagenum id="pg257" page="normal">257</pagenum>

<prodnote render="required">Producer's Note: This page contains Table XXX, which 

    has been produced on page 255.</prodnote>



Copyright © 2005 DAISY Consortium