To have glossary definitions in the same document that references them:
-
Create a DITA map for the definitions (for example,
glossary_keystore.ditamap
).The DITA map acts as a reference point for the glossary terms.
<glossref>
elements must include thetoc="yes"
attribute.<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd"> <map> <title>Glossary Keystore</title> <!-- Topics --> <glossref href="dita-def.dita" keys="dita" toc="yes"></glossref> </map>
-
Create a glossary entry topic (for example,
dita-def.dita
).The following is an example of glossary entry:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE glossentry PUBLIC "-//OASIS//DTD DITA Glossary Entry//EN" "glossaryentry.dtd"> <glossentry id="dita-definition"> <glossterm>Darwin Information Typing architecture</glossterm> <glossdef> <p>A specification that defines a set of document types for authoring and organizing topic-oriented information.</p> </glossdef> <glossBody> <glossSurfaceForm>DITA (format)</glossSurfaceForm> </glossBody> </glossentry>
-
Create a DITA map for the main content (for example,
my_document.ditamap
).Users must reference the glossary map, as in the following example:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd"> <map> <title>What is DITA?</title> <!-- Topics --> <topicref href="glossref-sample.dita"/> <!-- References --> <topicref> <topicmeta> <navtitle>Glossary</navtitle> </topicmeta> <mapref href="glossary_keystore.ditamap" format="ditamap"/> </topicref> </map>
-
Reference the glossary entry in a topic (for example,
glossref-sample.dita
), as in the following example:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> <concept id="glossref-sample"> <title>Glossref tooltip DITA sample</title> <conbody> <p><term keyref="dita"/> is based on XML.</p> </conbody> </concept>
-
Compress the parent folder and publish.
This example produces the following tooltip:
Selecting the link takes the readers to the topic: