Can links be used to reference specific rows or items within tables and lists in DITA?
Using links to reference specific rows or items within tables and lists in DITA XML is a powerful way to create cross-references and enhance the accessibility of your content. These references can provide additional context and information for users. Here’s how you can achieve this:
1. Linking to Table Rows: In DITA, you can link to specific rows within a table by using keyrefs. For example, let’s say you have a table that lists product features, and you want to provide more information about a particular feature:
<table>
<title>Product 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 information, see <keyword keyref="table.dita#feature1"/>.</ph>
2. Linking to List Items: Similarly, you can reference specific items within lists. For example, you may have a glossary with definitions and want to link to a specific term’s definition:
<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 using keyrefs and links in DITA XML, you can create efficient cross-references to specific rows in tables and items in lists, providing a richer and more informative experience for your readers.