6. Content inclusion Previous topic Parent topic Child topic Next topic

6.1. Easy content inclusion Previous topic Parent topic Child topic Next topic

About this task

The conref attribute of an element allows to reference the contents (text, child elements, some of the attributes) of another element.
Instead of just seeing an empty element having a conref attribute (that is, the ``pointer''), it is nicer to see the referenced contents. This process is called transclusion and XMLmind XML Editor can do it for you.
Note Everything explained here should also work for DITA maps.
Note The following procedure (Copy as Reference then Paste) is not specific to DITA. The same procedure could be used to add references to DocBook or XHTML documents. This is why it is explained in great details in our tutorial Opens in new window.

Procedure

  1. Open in XMLmind XML Editor the topic containing the element you want to reference.
  2. Select this element.
    Let's call this element the conref source.
    conref_source.gif
  3. If this element has no id attribute, specify one using the Attributes tool.
  4. Press Ctrl+Shift-C (EditReferenceCopy as Reference).
    You'll see the name of the element copied as reference displayed in dimmed blue at the bottom right of XMLmind XML Editor main window.
    clipboard.gif
  5. Switch to the topic where you want to create the reference.
  6. Use Ctr-U (EditPaste Before), Ctrl-V (EditPaste) or Ctrl-W (EditPaste After) to paste a reference to the conref source.
    Let's call this pasted reference the conref target.
    transcluded_conref_target.gif
  7. Sometimes, you'll want to add attributes which are specific to the conref target (typically an id attribute). In such case:
    1. Select the conref target.
    2. Use EditReferenceUntransclude to un-transclude the conref target.
      You'll see an element having the same name as the conref source but having no content and having a conref attribute pointing the conref source.
    3. Use the Attributes tool to specify one or more attributes.
    4. Use EditReferenceRetransclude to re-transclude the conref target.

6.2. Content inclusion: an alternative, low-level, method Previous topic Parent topic Child topic Next topic

Procedure

  1. Insert the element (the conref target) you wish to transform to a reference to another element contained elsewhere (the conref source).
    You may use Ctrl-H (EditInsert Before), Ctrl-I (EditInsert) or Ctrl-J (EditInsert After) to do this.
  2. Using the Attributes tool, specify an href attribute for the conref target.
    Specifying a value for the href attribute is tedious and error-prone. That's why using this method rather than the easy one described in Section 6.1 is not recommended.
  3. Specify other attributes, for example an id attribute, if you want.
  4. Use EditReferenceRetransclude to transclude the conref target.