Creating a modular document

XMLmind XML Editor allows to include in document B some content found in document A. This feature works by using a special command called Copy As Reference and then by using one of the normal Paste commands. Unlike the ordinary Copy/Paste commands which duplicate content, Copy As Reference copies a reference to some content found in document A. This means document B will always be up to date no matter how you'll modify document A.

(Internally, XMLmind XML Editor uses standard mechanisms, e.g. conref for DITA and XInclude for DocBook, to implement this feature, so you don't have to worry about the portability of the modular documents you'll create.)

This feature is generally used to create modular documents. For example, a modular DocBook book (Book.xml) includes several chapters, each chapter element being authored in its own file (Chapter1.xml, Chapter2.xml, etc). This way, different authors may work on different chapters at the same time and also, it's more comfortable to work on a relatively short chapter rather than on a large, monolithic, book.

This feature is also used to include “boilerplate” content in a document: company name, product name, copyright statement, etc. More about this in next lesson: Inserting boilerplate content.

??? EditReferenceCopy As Reference (keyboard shortcut: Ctrl+Shift-C) works like ordinary ??? EditCopy (keyboard shortcut: Ctrl-C), except that the node selection must comprise a single element and this element must have an ID (or if it does not have an ID, it must be the root element of the document). After you invoke Copy As Reference, notice that the Clipboard tool displays the name of the referenced element using a dimmed blue/gray color.

The clipboard containing a reference

Note that it's not possible to Copy As Reference some included content. If you want to do that, simply use the normal Copy command. The normal Copy and Cut commands both preserve references when they are used to copy content to the clipboard.

After using ??? EditPaste Before (keyboard shortcut: Ctrl-U), ??? EditPaste (keyboard shortcut: Ctrl-V) or ??? EditPaste After (keyboard shortcut: Ctrl-W) to paste the reference copied using Copy As Reference, the included content is rendered using a blue/gray color. This special color means that the included content is read-only. That is, it cannot be edited in place.

Read-only included note

In order to edit some included content, you'll have to open the document which actually contains the data. Fortunately, this is done very easily by using menu item ??? EditReferenceEdit Referenced Document (keyboard shortcut: Ctrl+Shift-E).

From there, switching back to the included content is done by using menu item ??? EditReferenceEdit Referencing Document (keyboard shortcut: Ctrl+Shift-B).

Screencast Watch the screencast