Reusing content is one of the key features of DITA and DITA provides several methods for reusing content. Oxygen XML Author Eclipse plugin provides support for each of these methods.
A DITA topic does not belong to any one publication. You add a DITA topic to a publication by referencing it in a map. You can reference the same topic in multiple maps.
DITA allows you to reuse content by referencing it in another topic.
DITA provides several mechanisms for
including content by reference (conref, conkeyref,
coderef). A conref
(content reference) creates a direct reference to a specific element of another
topic. A conkeyref (content key
reference) creates a reference to a key, which then points to a specific element in
another topic. The advantage of using a conkeyref is that you can change the
element that is included by changing the key reference. For example, since keys are defined
in maps, if you include a topic in multiple maps, you can use a different key reference in
each map. A coderef references an external file that contains literal code.
Oxygen XML Author Eclipse plugin provides support for all of these mechanisms.
While the conref and conkeyref mechanisms can be used to reference any content element, it is considered best practice to only conref or conkeyref content that is specifically set and managed as reusable content. This practice helps reduce expensive errors, such as an author accidentally deleting the source element that other topics are including by the reference. Oxygen XML Author Eclipse plugin can help you create a reusable component from your current content.
DITA allows you to select content in a topic, create a reusable component from it and reference that component in other locations. Each reusable component is created as a separate file. Anytime the content needs to be edited, you only need to update it in the component file and all the locations in your topics that reference it will also be updated. This can help you to maintain continuity and accuracy throughout your documents.
DITA allows you to replace the content of certain elements with a value that is pointed to by a key. This mechanism effectively means that you can create variables in your content, which you can then create multiple outputs by changing the value that the key points to. This is done by profiling the definition of the key value, or by substituting another map with a different key value.
DITA 1.3 allows you to use some advanced concepts to expand content reuse possibilities even further. Key Scopes (or scoped keys) allow you to reuse topics with variable content depending on the particular context and it maximizes reuse possibilities for keys. Branch Filtering allows you to reuse the same content that is profiled in multiple ways within the same publication, each time using a different filter.
If you use a large amount of keys or reusable components in your DITA project, the DITA Reusable Components view can be quite helpful. It collects all of the keys and reusable components that are defined in the root map and presents them in a dynamic table where you can easily locate and insert references to them.
Oxygen XML Author Eclipse plugin includes some actions that are specifically designed for DITA reusable content. These actions are available in the contextual menu, the DITA menu, and some are available on the toolbar.
Reuse
ContentThis action provides a mechanism for reusing content fragments. It
opens the Reuse Content dialog box that allows you to insert
several types of references to reusable content at the cursor position. The types of
references that you can insert using this dialog box include content references (@conref), content key references (@conkeyref), or key references to metadata (@keyref).
@conref or
@conkeyref attribute. It opens the Edit Content
Reference dialog box that allows you to edit the source location (or key)
and source element of a content reference (or content key reference), and the reference
details (@conref/@conkeyref and
@conrefend attributes). For more information, see Reuse Content Dialog Box.@conref or
@conkeyref) at the cursor position with its content from it source.
This action is useful if you want to make changes to the content in the currently edited
document without changing the referenced fragment in its source location. If the source
content includes references to other topics/resources (hrefs), the operation also
resolves those references relative to the new location. Attributes are preserved
according to the following priority:-dita-use-conref-target
value.@id attributes.@keyref, @conref,
or @conkeyref) in the current document with the content. Attributes
are preserved according to the following priority:-dita-use-conref-target value.@id attributes.For keyrefs inside <xref> or
<link> elements, the @keyref attribute is
changed to an @href attribute, while the rest of the content for the
keyref is replaced with its source content.
If the source content includes references to other topics/resources (hrefs), the operation also resolves those references relative to the new location.
@conref or @conkeyref)
inside the element at the cursor position.@conref). If multiple elements are
selected (for example, multiple steps or list items), the selection will be replaced
with a content reference range (@conref and
@conrefend).
For more information, see Creating a Reusable Content Component.