What is the role of the <table> element in DITA?

In DITA, the <table> element is used to define structured tables within topics. Tables are an essential component of technical documentation, allowing presentation of data, comparisons, and organized information. The <table> element provides a way to structure and format tabular data effectively.

The <table> element serves as the container for tabular data. Inside a <table>, the structure of rows and columns can be defined using additional elements such as <row>, <entry>, and <entrytbl>.

The <table> element may have attributes such as @id for identification and @class for specifying a CSS class. Common attributes for <table> include @frame to define the table frame, @pgwide for page-wide tables, and @colsep and @rowsep for controlling cell separation.

DITA tables also incorporate the following additional elements:

  • <row>: Used to define individual rows within the table.
  • <entry>: Represents data or content within a table cell.
  • <entrytbl>: For creating nested tables within table cells.
  • <sthead>: Specifies table header content for simple tables.


The following simple table is defined using DITA elements:

<table id="sample-table" frame="all" pgwide="1">
  <title>Sample Table</title>
  <tgroup cols="3">
    <colspec colname="col1"/>
    <colspec colname="col2"/>
    <colspec colname="col3"/>
        <entry>Header 1</entry>
        <entry>Header 2</entry>
        <entry>Header 3</entry>
        <entry>Row 1, Cell 1</entry>
        <entry>Row 1, Cell 2</entry>
        <entry>Row 1, Cell 3</entry>
        <entry>Row 2, Cell 1</entry>
        <entry>Row 2, Cell 2</entry>
        <entry>Row 2, Cell 3</entry>

In this example, the <table> element defines a simple table with a title, frame, and page-wide attribute. The <colgroup> element specifies the number of columns, and the <thead> element contains header information. The <tbody> element defines the table body with rows and data cells using <tr> and <td>.