Aaron
Aaron

Reputation: 105

DITA: conkeyref, keydef and valid URIs

My company are trying to use similar to the below code for their conkeyrefs in DITA, I believe it is invalid but want to verify.

In their DITA topic:

<element conkeyref="keyName"/>

In their DITA map:

<keydef href="fileName#elementID"
            keys="keyName"/>

The href I am pretty sure is invalid: It should be "fileName#topicID/elementID"

But I am also unsure about how they have used the href and conkeyref in combination. In all the information I have searched through online I cannot find an example like the above, all examples are like the one below (when referencing an element in a map or topic and not the topic or map themselves). In the topic:

<element conkeyref="keyName/elementID"/>

In the map:

<keydef href="fileName" keys="keyName"/>

Is the combination my company are using valid - just rarely used?

Upvotes: 0

Views: 266

Answers (1)

Radu Coravu
Radu Coravu

Reputation: 1924

A key definition in a DITA Map must always point with the @href attribute to a topic ID. So it can either be like this:

<keydef href="fileName"/>

in which case it points to the first topic in the file or like this:

<keydef href="fileName#topicId"/>

in which case it points to a specific topic in the file. But it can never point to a specific element ID in the file.

The DITA 1.3 specification: https://www.oxygenxml.com/dita/1.3/specs/langRef/base/keydef.html

states that for the @href attribute:

References to DITA content cannot be below the topic level: that is, you cannot reference individual elements inside a topic. 

Regards, Radu

Upvotes: 1

Related Questions