Are there elements for indicating row headers in DITA?
November 10, 2023
|By Bryan Tipper
Row headers in tables can be defined using the rowsep and rowsepentry elements. These elements define row headers in a DITA table. Row headers typically label the columns of the table, providing information about the data in each column. Their key attribute is rowsepname, which assigns a name to the row header.
- rowsep: The rowsep element is used to define a header row in a DITA table. It serves as a container for row header information. The rowsep element must include one or more rowsepentry elements.
- rowsepentry: The rowsepentry elements are used within the rowsep element to define the individual header cells. Each rowsepentry element corresponds to a specific column in the table and provides the header text for that column. The rowsepentry elements may contain the name of the column or other relevant header information.
<table>
<title>Product Comparison</title>
<tgroup cols="3">
<colspec colname="col1" colnum="1" colwidth="20%"/>
<colspec colname="col2" colnum="2" colwidth="30%"/>
<colspec colname="col3" colnum="3" colwidth="50%"/>
<thead>
<row>
<entry colname="col1">Product</entry>
<entry colname="col2">Features</entry>
<entry colname="col3">Price</entry>
</row>
<rowsep>
<rowsepentry>Specifications</rowsepentry>
<rowsepentry>Product Highlights</rowsepentry>
<rowsepentry>Pricing</rowsepentry>
</rowsep>
</thead>
<tbody>
<row>
<entry>Product A</entry>
<entry>Feature set A</entry>
<entry>$100</entry>
</row>
<row>
<entry>Product B</entry>
<entry>Feature set B</entry>
<entry>$120</entry>
</row>
</tbody>
</tgroup>
</table>
In this example:
- The thead section contains a header row with regular entry elements to label the columns.
- Below the header row, the rowsep element defines a second row with rowsepentry elements that serve as row headers. Each rowsepentry element corresponds to a specific column, providing header information.
- The rowsepname attribute, which can be used in each rowsepentry element, assigns a name to the row header, such as “Specifications,” “Product Highlights,” and “Pricing.”