We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.
As far as I can tell, in a map you can define a key to reference a topic:
<keydef href = "Concepts/c_access_control_policies.xml"
keys = "access control policies" type = "concept"><topicmeta>
<navtitle>Access control policies</navtitle></topicmeta></keydef>
For entire topics this is fine: I can then use they key "access control policies" whenever I need to reference this topic.
However, I'd like to be able to reference an element within a topic. For example, have a topic that lists all the standard terms and phrases; each of these elements would have unique IDs etc. In the map, I'd then create keydefs to reference these elements. So far, I've been unable to do this.
I can easily create references to these standard terms and phrases via conrefs, but each time I want to create a conref, I have to go through the process of locating the file etc. I would have thought that keys would be easier.
Any help gratefully received.
For references to topics, maps, and non-DITA resources, the value of the @keyref attribute is simply a key name: keyref="topic-key". However for references to non-topic elements within topics and non-topicref elements within maps, the value of the @keyref attribute is a key name, a solidus ("/"), and the ID of the target element: keyref="topic-key/some-element-id"
For example, consider this topic in the document "file.dita":
<title>Example referenced topic</title>
<p id="para-01">Some content.</p>
And this key definition:
A keyref of the form "myexample/para-01" resolves to the <p> element in the topic. Let me know if I understood your question correctly.
Thank you for your your clear response.
The problem was that I was expecting to be able to see the key when browsing for it via the Source > Refer to Key > Edit button, which would only take me to the topic file.
By simply entering the keyname/id_name into the Refer to Key field, this works perfectly.
I now have a key called "standard_phrases", which refers to the file that contains all the standard stuff, and can insert any material within that file using: standard_phrases/reference
I'm using the 2019 version I have tried to do according your instructions written above, but I don't get the text to my file. Do you have any ideas why? See my test below:
<title>MY TEST MAP</title>
<keydef href="MyTestingVariables.dita" keys="ReuseTest"
<topicref href="My test concept.xml" type="concept">
<navtitle>My test concept</navtitle>
<title>My test concept</title>
<shortdesc>Only for testing</shortdesc>
<p>The name of the product is
MY TOPIC WITH REUSABLE CONTENT:
<shortdesc>Only a location for references.</shortdesc>
<keyword id="productname">Test product</keyword>
For using the keyref in the concept, it works via this way
so either you could define the keyword at map level or if it is within a topicref, add the same through xref. This seems to be a bug in DITA-OT as well for 2.X
Hope this helps.
Thank you for your reply!
I fixed the problem with keyspace. I had tried it earlier but with no luck. The reason was I did it in a wrong way earlier.
I can also try this method at some point.