How are table headers defined in DITA?
In DITA XML, defining table headers is crucial for creating well-structured and accessible tables in your documentation. Properly defined headers improve the clarity of your content and assist users and tools in understanding the data presented. Let’s explore how table headers are defined in DITA XML.
Header Cells
In DITA XML, you designate header cells within a table to identify them as headers. Header cells contain text that serves as labels for columns and rows. These headers provide context to the data within the table, making it easier for readers and assistive technologies to interpret the information. When defining header cells, you use specific DITA XML attributes to mark them as such. By differentiating header cells from data cells, you create a well-structured table that enhances the user experience.
Example:
Here’s an example of how you can define table headers in DITA XML:
<table>
<tgroup cols="3">
<colspec colname="col1" colwidth="30%" />
<colspec colname="col2" colwidth="40%" />
<colspec colname="col3" colwidth="30%" />
<tbody>
<row>
<entry><th>Header 1</th></entry>
<entry><th>Header 2</th></entry>
<entry><th>Header 3</th></entry>
</row>
<row>
<entry>Data 1</entry>
<entry>Data 2</entry>
<entry>Data 3</entry>
</row>
</tbody>
</tgroup>
</table>
In this example, <th> tags are used to mark the header cells, providing a clear distinction from regular data cells. The DITA XML attributes like <tgroup> and <colspec> help define the table’s structure, and the use of <th> tags in header cells ensures that the table headers are correctly identified.