## 5. Creating a DITA map using drag and drop

### Procedure

1. Use File → New and choose DITA Map | Map.
2. Use File → Save As to give a filename to the newly created map.
3. Drag a reference to a topic:
   - Using your file manager. Simply drag the icon representing the XML file containing the topic.
   - OR using your web browser. Simply drag the link to the topic as found in an HTML page (or the corresponding bookmark icon as found in the location bar).
   - OR using XXE itself.
     In such case, open in XXE the topic you want to reference and click on the dashed line found at the bottom the tab of the document view to have both the map and the topic side by side.
     For this task, it may be more convenient to have one view at the right of the other rather than one view below the other. To do this, use Options → Quick Preferences → Split Window Vertically.
     - Click anywhere on the document view containing the topic to make sure this document is the active one and then, drag the file icon(1) found in XXE's node path bar.
     - OR, if the DITA file contains several nested topics, first select the topic element you want to reference as if you wanted to edit it(2) and then drag anywhere inside it while pressing the Alt key to drag its reference.

       Note

       Alt-drag allows to drag any element having an `id` attribute without having to select it first. However in the case of a container element such as a `section` or a `topic`, it is much easier to first select the element for which you want to drag a reference and then, alt-drag anywhere inside it.
       Note that this drag facility is fully aware of the way elements are referenced in DITA. For example, if you drag a `p` element having "`audience`" as its `id` attribute and if this `p` element is contained in a `topic` element contained in file `file://home/john/doc/topic1.dita` and having "`introduction`" as its `id` attribute, you'll end up dragging string "`file://home/john/doc/topic1.dita#introduction/audience"`.

4. Drop the dragged reference onto the text which immediately follows the link icon of a `topicref`. This text is "`???`" in the case of a newly created `topicref` such as the one depicted in this screen shot: .
   XXE will automatically attempt to make the dropped reference relative to the location of the drop site. If, for example, you drop `file://home/john/doc/topic1.dita` onto a `topicref` element contained in `file://home/john/doc/maps/book.ditamap`, its `href` attribute will contain "`../topic1.dita`". If the dropped reference cannot be made relative to the location of the drop site (for example, if it is an `http://` URL) then the `href` attribute will contain the dropped reference as is.

(1) | For an unknown reason, this will not work on the Mac.

(2) | There are many ways to do this. For example, click several times anywhere inside the topic, while pressing the Ctrl key and without moving the mouse, until you ``reach'' it. More information in XMLmind XML Editor - User's Guide, "Being productive with XXE".