How are DITA tables integrated with text and other content?

In DITA, tables are an essential element for presenting structured data within your documentation. You can integrate DITA tables with text and other content by embedding them into your DITA topics using specific XML markup. This allows you to effectively organize and display tabular information alongside your textual content.

Defining Tables in DITA

To integrate a table into your DITA content, you need to define it using XML elements. In DITA, you typically use the <table> element to create tables. Within the <table> element, you can include <row> elements to define rows and <entry> elements to specify the individual cells. You can also use attributes like “cols” and “colsep” to control the structure and appearance of the table. These tables can be easily incorporated within your topics alongside textual content.

Example:

Here’s an example of how a simple table can be defined in DITA:


<table cols="3" border="all">
  <tgroup cols="3">
    <colspec colname="col1" colnum="1"/>
    <colspec colname="col2" colnum="2"/>
    <colspec colname="col3" colnum="3"/>
    <tbody>
      <row>
        <entry>Cell 1</entry>
        <entry>Cell 2</entry>
        <entry>Cell 3</entry>
      </row>
      <row>
        <entry>Cell 4</entry>
        <entry>Cell 5</entry>
        <entry>Cell 6</entry>
      </row>
    </tbody>
  </tgroup>
</table>

In this example, a DITA table is created with three columns and two rows. The table can be seamlessly integrated with surrounding textual content within a DITA topic, providing a structured way to present data.