Can DITA tables be reused across multiple topics?

In DITA, tables can be reused across multiple topics by defining tables in separate topics or within content references. This reuse simplifies content management, ensures consistency, and allows maintaining and updating tables in a centralized manner, affecting all instances where the table is used.

Best Methods for Reusing Tables

The best methods of reusing tables are defining tables in their own separate topics and using content references.

Define Tables in Separate Topics

Create a dedicated DITA topic that contains the table(s) for reuse.

This topic serves as a repository for tables intended to be used in other topics.

Define the tables in this dedicated topic with appropriate table elements, structure, and content.

Content References

In the topics where a specific table is required, use content references.

Content references are mechanisms for reusing content from other topics. The entire table topic or specific elements within it can be referenced.

Example: Reusing a Keyboard Shortcuts Table

A software documentation project has various topics explaining different software features. It needs to include a common table that outlines keyboard shortcuts across multiple topics. To do this, a dedicated DITA topic, “keyboard-shortcuts.dita,” is created to store the keyboard shortcuts table.

keyboard-shortcuts.dita


<topic id="keyboard-shortcuts">
  <title>Keyboard Shortcuts</title>
  <table>
    <title>Common Keyboard Shortcuts</title>
    <tgroup cols="2">
      <thead>
        <row>
          <entry>Shortcut</entry>
          <entry>Description</entry>
        </row>
      </thead>
      <tbody>
        <row>
          <entry>Ctrl + C</entry>
          <entry>Copy</entry>
        </row>
        <row>
          <entry>Ctrl + V</entry>
          <entry>Paste</entry>
        </row>
        <!-- More rows for additional shortcuts -->
      </tbody>
    </tgroup>
  </table>
</topic>
  

Now, this table can be referenced in the software feature topics:

Feature Topic 1


<topic id="feature-1">
  <title>Feature 1</title>
  <p>Here are some common keyboard shortcuts:</p>
  <xref href="keyboard-shortcuts.dita#keyboard-shortcuts/table"/>
</topic>
  

Feature Topic 2


<topic id="feature-2">
  <title>Feature 2</title>
  <p>Learn these keyboard shortcuts:</p>
  <xref href="keyboard-shortcuts.dita#keyboard-shortcuts/table"/>
</topic>