Search code examples
xmlditaoxygenxml

Is it possible to reference a DITA <topichead> element?


My goal is to provide a link to the start of a major section of documentation, which begins with a <topichead> element as a section title only.

I could not figure out a way to do this via a conref. In the main map file sequence.ditamap, the <topichead> element is written as follows:

<topichead id="th_adding_usrs">
    <topicmeta>
        <navtitle>Adding a new user to the team</navtitle>
    </topicmeta>
    <topicref href="tasks/requests.dita"/>
    <topicref href="tasks/db_sets.dita"/>
    <topicref href="tasks/user_support.dita"/>
</topichead>
<topicref href="concepts/integration.dita"/>

The reference to the <topichead> th_adding_usrs occurs in the topic integration.dita.

From integration.dita, I tried putting conref="sequencing.ditamap#th_adding_usrs" inside of a <p> element and, then a <ph> element as well, but both still give me an error (I'm using the OxygenXML editor, v20.1) reporting that the Conref was not expanded, because it was unable to find target for conref="sequence.ditamap#th_adding_usrs".

I also tried an <xref> element inside of the <p> element above, with the conref attribute also as above, but get the same error.

Is it even possible to cross-reference (or otherwise provide a clickable link) to a <topichead> element?

And, more broadly, is there an advantage to using the <topichead> element over an actual <topicref> that has a title only and no content? I'm following the convention used within my company, but I'm not required to so. So, if there's no advantage to a <topichead>, I'll just avoid using them in favor of a title-only <topicref>.


Solution

  • Adding keys to the topichead as well as the topicrefs allows the use of a keyref attribute inside of an xref element to link to the topichead.

    So <topichead id="th_adding_usrs"> with a key added is <topichead keys=”adding_usrs” id="th_adding_usrs">, and the topic integration.dita with a key is .

    Within integration.dita, using an xref like: <p>Refer to <xref keyref=”adding_usrs”/></p> links correctly.