## 6. Content inclusion

## 6.1. Easy content inclusion

### 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 .

### 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.
3. If this element has no `id` attribute, specify one using the Attributes tool.
4. Press Ctrl+Shift-C (Edit → Reference → Copy 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.
5. Switch to the topic where you want to create the reference.
6. Use Ctr-U (Edit → Paste Before), Ctrl-V (Edit → Paste) or Ctrl-W (Edit → Paste After) to paste a reference to the conref source.
   Let's call this pasted reference the conref target.
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 Edit → Reference → Untransclude 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 Edit → Reference → Retransclude to re-transclude the conref target.

### Related information

‣ Section 6.2. Content inclusion: an alternative, low-level, method

## 6.2. Content inclusion: an alternative, low-level, method

### 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 (Edit → Insert Before), Ctrl-I (Edit → Insert) or Ctrl-J (Edit → Insert 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 Edit → Reference → Retransclude to transclude the conref target.

### Related information

‣ Section 6.1. Easy content inclusion