Sunday, September 21, 2014

Tools for reuse--The conref attribute

The conref attribute (conref stands for content reference) allows you to reuse text at an element level.

Suppose you want to reuse the text of a warning. You would assign an element ID to the note tag containing the warning text in the original file. In a second file, you would reference that warning  by using the conref attribute on a note tag.

 For example, the original file is named topic1.dita with a topic ID of 111. The note tag reads:

 <note id="damage" type="warning"> You can cause serious damage.</note>

Notice that the element ID on the note tag is damage

Here’s the syntax you would use for the conref attribute:

filename.xml#topicid/elementid

The note tag in the second file would read:

 <note conref="topic.dita#111/damage"/> 
 
The result would be a duplicate of the original warning.

In my next posting, I will discuss a best practice for conrefs.

No comments:

Post a Comment