What is the syntax for creating links to tables and lists in DITA?

Creating links to tables and lists in DITA XML involves using keyrefs to reference specific rows or items within these structures. This syntax allows you to establish cross-references within your DITA content, enhancing its interactivity and accessibility. Let’s explore how to do this with tables and lists.

1. Linking to Tables: In DITA, you can create links to specific rows within tables. Consider the following table that lists software features:


<table>
  <title>Software Features</title>
  <tgroup>
    <tbody>
      <row id="feature1">
        <entry>Feature 1</entry>
        <entry>Description of Feature 1</entry>
      </row>
      <row id="feature2">
        <entry>Feature 2</entry>
        <entry>Description of Feature 2</entry>
      </row>
    </tbody>
  </tgroup>
</table>

To link to “Feature 1” from another topic, you can use the following keyref:


<ph>For more details, see <keyword keyref="table.dita#feature1"/>.</ph>

2. Linking to Lists: Similarly, you can reference specific items within lists. For example, here’s a glossary entry:


<list type="glossary">
  <item id="term1">
    <ph>Term 1</ph>
    <ph>Definition of Term 1</ph>
  </item>
  <item id="term2">
    <ph>Term 2</ph>
    <ph>Definition of Term 2</ph>
  </item>
</list>

To link to “Term 1” and its definition from another topic:


<ph>Learn more about <keyword keyref="glossary.dita#term1"/>.</ph>

By following this syntax, you can effectively create links to specific rows in tables and items in lists, improving the way users navigate and engage with your DITA content.