Table
A simple table is a basic tabular environment that is designed to present organized content.
Syntax
The syntax for representing this component varies depending on the authoring format:
Authoring format | Syntax and example |
---|---|
XDITA |
|
HDITA |
|
MDITA |
A table should contain a header row, a delimiter row, and
zero or more rows with entries. Table entries inside a row
should be separated by pipes (
|
Usage information
The simpletable component is designed for close compatibility with HTML5 tables. It can contain a title and allows column and row spanning.
Attributes
The available attributes vary based on the authoring format:
- XDITA and HDITA
- The following attributes are available on this element: ID
attributes, localization attributes, universal
attributes, and
@props
. - MDITA
- There is no attribute support for the MDITA core profile. For the MDITA extended profile, attributes can be specified by using the HDITA representation.
Examples
This section is non-normative.
This section contains examples of how the table component can be used in the three authoring formats:
The following code sample shows how the
<simpletable>
element can be used to
represent a table that presents information about dog breeds:
<simpletable id="dog-breeds-table">
<title>Dog breeds</title>
<sthead>
<stentry><p>Breed</p></stentry>
<stentry><p>Average size</p></stentry>
<stentry><p>Life expectancy</p></stentry>
</sthead>
<strow>
<stentry><p>Australian Shepard</p></stentry>
<stentry><p>Medium</p></stentry>
<stentry><p>12-15 years</p></stentry>
</strow>
<strow>
<stentry><p>Beagle<p></stentry>
<stentry><p>Small</p></stentry>
<stentry><p>10-15 years</p></stentry>
</strow>
<strow>
<stentry><p>Great Dane</p></stentry>
<stentry><p>Extra-large</p></stentry>
<stentry><p>7-10 years</p></stentry>
</strow>
</simpletable>
Note that the table has a title, as well as an
@id
attribute that makes it possible to reuse
this table in other contexts.
For an example of a table with spanned rows, see Figure 1.
The following code sample shows how the
<table>
element can be used to represent
a table that presents information about dog breeds:
<table id="dog-breeds-table">
<caption>Dog breeds</caption>
<tr>
<th><p>Breed</p></th>
<th><p>Size</p></th>
<th><p>Life expectancy</p></th>
</tr>
<tr>
<td><p>Australian Shepard</p></td>
<td><p>Medium</p></td>
<td><p>10-15 years</p></td>
</tr>
<tr>
<td><p>Beagle</p></td>
<td><p>Small</p></td>
<td><p>12-15 years</p></td>
</tr>
<tr>
<td><p>Great Dane</p></td>
<td><p>Extra-large</p></td>
<td><p>7-10 years</p></td>
</tr>
</table>
Note that the table has a title, as well as an
@id
attribute that makes it possible to reuse
this table in other contexts.
For an example of a table with spanned rows, see Figure 2.
The following code sample shows how a simple table can be represented in MDITA. Note that MDITA does not have a formal way to associate a title with a table, nor does it have a way to associate an ID with the table.
| Dog breed | Size | Life expectancy |
| ------------------ | ----------- | --------------- |
| Australian Shepard | Large | 12-15 years |
| Beagle | Medium | 10-15 years |
| Great Dane | Extra-large | 7-10 years |