How are content tables (informal tables) structured in DITA?
In DITA, content tables, also known as informal tables, offer a way to organize data in a tabular format without the complexity of formal tables. These tables are commonly used to present information clearly and concisely.
Implementing a content table involves the table element, columns and rows, cell content, optional header rows, and styling.
Table Element:
To create a content table, the <table>
element is used. The <table>
element is the parent container for the entire table structure.
Columns and Rows:
Within the <table>
element, rows are defined using the <row>
element, and columns within each row using the <entry>
element. Unlike formal tables, content tables don’t require specifying the number of columns explicitly.
Content in Cells:
Each <entry>
element holds the content that corresponds to a cell in the table. This content can be text, numbers, links, inline elements, or any combination thereof.
Optional Header Rows:
While content tables typically lack headers, the first row in the table can be used as a header row, visually distinguishing it from regular content. It can be styled differently, such as by adding shading, or using bold text to indicate it as a header.
Styling:
Content tables are often styled using CSS (Cascading Style Sheets) or other formatting options to control their appearance. Styling can include adjusting borders, cell padding, and text alignment.
Example:
Here’s a simple content table structured in DITA:
<table>
<title>Sample Content Table</title>
<row>
<entry>Product</entry>
<entry>Description</entry>
<entry>Price</entry>
</row>
<row>
<entry>Product A</entry>
<entry>High-quality product</entry>
<entry>$100</entry>
</row>
<row>
<entry>Product B</entry>
<entry>Advanced features</entry>
<entry>$150</entry>
</row>
</table>
In this example:
- The
<table>
element encapsulates the entire table. - Each
<row>
represents a row of data. <entry>
elements within each row hold the content for cells.- The first row contains the headers.
- The table includes a title for context.