Search code examples
dita

Use of topicmeta in topic body


I am starting to use DITA for writing product specifications. I use the "prodname" metadata to put the product number in the header. Now I am wondering how if at all I can use the same information in the body part of my document. Is there a DITA way to use this information for my purpose? Or is this not "proper" usage?


Solution

  • You can create a <keyword> element and reuse it via a key reference.

    DITA Map

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
    <map>
     <title><keyword keyref="product"/></title>
     <keydef keys="product">
      <topicmeta>
       <keywords>
        <keyword>my product</keyword>
       </keywords>
      </topicmeta>
     </keydef>
     <topicref href="topic.dita"/>
    </map>
    

    DITA Topic

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
    <topic id="topic">
      <title>my topic</title>
      <prolog>
        <metadata>
          <prodinfo>
            <prodname>
              <keyword keyref="product"/>
            </prodname>
          </prodinfo>
        </metadata>
      </prolog>
      <body>
        <p><keyword keyref="product"/></p>
      </body>
    </topic>