Chapter 4. Being productive with XXE
Prev |  |

## Chapter 4. Being productive with XXE

## 1. Do not use the tree view

Do not use the tree view. You can do everything efficiently in the styled view. If this is not the case, then you have missed something in the tutorial.

The tree view has been designed to allow editing documents for which a style sheet has not yet been written.

## 2. Quickly type plain text after a bold or italic element

Use the Insert key to insert a `#text` node after explicitly selected node or implicitly selected element.

This is often handy in the following situation: you have typed some text in a paragraph then inserted a `strong` for which you have typed text.

Then how to quickly continue typing plain text after the `strong`? The answer is: use the Insert key of your keypad.

Also note that Shift-Insert inserts a `#text` node before explicitly selected node or implicitly selected element.

### Mac Users

There is no Insert key on the Mac. Instead, you need to use the F1 function key.

## 3. Quickly insert after an element, another element of the same type

- Use Ctrl-Insert to insert after explicitly or implicitly selected element, an element of the same type.

  Example: you want to quickly add a section after current section. Select the section using the node path bar and type Ctrl-Insert.

  Also note that Ctrl-Shift-Insert inserts before explicitly or implicitly selected element, an element of the same type.

- Even quicker than previous tip, Ctrl-click in the node path bar on the name of the element you want to duplicate.

  Also note that if you Shift-click in the node path bar on the name of the element, this selects this element and then creates a new element of same type before this element.

  Remembering these two tips is easy, the node path bar has a contextual menu which is displayed when you click using the right mouse button.

- Most XXE configurations (XHTML, DocBook, DITA, etc) bind keystrokes Ctrl-Enter and Ctrl-Shift-Enter to the following actions:

  - Ctrl-Enter pressed anywhere inside a paragraph or a list item (i.e. any commonly used, repeatable, element) inserts a new paragraph or a list item after it.

  - Ctrl-Shift-Enter pressed anywhere inside a paragraph or a list item inserts a new paragraph or a list item before it.

## 4. Use auto-completion as much as possible

- When choosing an element using Edit tool, type the element name (or "(text)" to specify a text node) in the text field instead of clicking on it in the element list. This text field supports auto-completion.

  User preferences related to auto-completion can be changed using the Preferences dialog box, Edit section.

- When adding an attribute to an element or when changing the value of an attribute, use the attribute form rather than the attribute table:

  1. Type the name of the attribute in the name field (first field of the form).

  2. Press Enter to move to the value field (second field of the form).

  3. Type the value of the attribute in the value field.

  4. Press Enter to commit the change and to give the keyboard focus back to the document view.

  Both the name and value fields support auto-completion. However auto-completion in the value field only works for attributes having the following types: any enumerated type, `ID`, `IDREF`, `IDREFS`.

  This auto-completion feature can be configured using the Preferences dialog box, Edit section.

## 5. When possible, apply commands to node ranges

Use the keyboard to select a node range:

- Esc Down Arrow (that is: type Esc, then type Down Arrow) selects all child nodes of implicitly or explicitly selected element.

- Esc Right Arrow extends node selection to following sibling.

- Esc Left Arrow extends node selection to preceding sibling.

Note Esc Right Arrow (and Esc Left Arrow) will first select element containing caret if there is no explicit node selection, therefore typing Esc Right Arrow several times is often the quickest way to select a node range.

## 6. Learn important keyboard shortcuts

Command | Keyboard shortcut | Trick to remember the keyboard shortcut
--- | --- | ---
Undo | Ctrl-Z | Standard shortcut
Redo | Ctrl-Y | Standard shortcut
Repeat | Ctrl-A | A like Again
Cut | Ctrl-X | Standard shortcut
Copy | Ctrl-C | Standard shortcut
Paste | Ctrl-V | Standard shortcut
Paste Before | Ctrl-U | Ctrl-V means Paste and U is before V
Paste After | Ctrl-W | Ctrl-V means Paste and W is after V
Delete | Ctrl-K | K like Kill
Replace | Ctrl-R | R like Replace
Insert | Ctrl-I | I like Insert
Insert Before | Ctrl-H (Cmd-B on the Mac) | Ctrl-I means Insert and H is before I
Insert After | Ctrl-J | Ctrl-I means Insert and J is after I
Convert | Ctrl-T | T like Transform
Wrap | Ctrl-Shift-T | T like Transform (variant of Convert)
Split | Esc Enter | A paragraph-specific form of Split is often bound to the Enter keystroke
Join | Esc Backspace | A paragraph-specific form of Join is often bound to the Backspace keystroke
Search | Ctrl-F | Standard shortcut F like Find
Replace | Ctrl-M | M like Modify
Find Next | Ctrl-G | Standard shortcut

### Mac Users

- Use the Cmd key instead of the Ctrl key, except for Ctrl-Tab (insert tab character) and Ctrl-Space (insert non breaking space).

- Use Ctrl-button1 to emulate mouse button3.

- Use Alt-button1 to emulate mouse button2.

Note that using a 2-button mouse with a scroll wheel on the Mac is not only very well supported but also highly recommended.

### Tip

A quick reference card in PDF format is available in four different flavors: A4, Letter, for the Mac/A4, for the Mac/Letter.

### Tip

Use XXE add-on manager (Options|Install Add-ons) to download and install the add-on containing a sample `customize.xxe` file. This customization file contains many truly useful macro-commands and their associated bindings.

## 7. Quickly paste selected text using mouse button #2

Use the mouse to quickly copy and paste text:

- Selecting text automatically ``copies it as system selection'' on platforms supporting system selection (X-Window) and automatically copies it to an internal clipboard on other platforms.

- Clicking with mouse button #2 (middle button or mouse wheel) pastes the content of system selection on platforms supporting system selection and pastes the content of an internal clipboard on other platforms.

Note that unlike Edit|Copy which copies characters as well as nodes, selecting text this way just copies characters to the system selection.

This functionality is disabled by default. To enable it, please use the Preferences dialog box, Edit section and check "Clicking with middle button pastes system selection".

## 8. Drop graphics files on `img`, `imagedata`, `image`, etc, elements

When an image is displayed in a styled document view, the simplest way to change it is to drag and drop a file on it.

When a file is dropped on an image, a pre-filled, specialized dialog box is displayed to let the user specify exactly what he wants to do with the image file.

For example, if the image file is referenced in attribute `fileref` of element `imagedata` (like in screenshot below), the user is given the choice between

- copying the image to the document directory and then updating the reference to the image file in the attribute,

- OR just updating the reference to the image file in the attribute.

The same dialog box can be opened without having to drop a file on an image displayed in the document view: simply double-click on the image.

This functionality has been implemented mainly to allow users to upload images to the remote site when they edit documents stored on a FTP or WebDAV server, but this is also very handy when working on the local file system.

## 9. Easily select paragraphs, list items, table rows, etc, using the ``interactive gray margins''

The easiest way to select a paragraph or a table row is to use the option which adds ``interactive gray margins'' at the left and/or at the right of the document view.

By default these interactive margins are absent. To enable them, you need to use Options|Preferences, Edit section and check one or both the "Add interactive margin to the styled view" toggles. After doing this, you'll also need to reload any opened document.

Example, using interactive margins to select an `ul` in an XHTML document:

Move the mouse in the gray margin found at the left and/or at the right of the document view. Here you'll notice that the cursor changes its shape. Move the cursor in front of any list item and click once. Mouse clicks in the left or in the right margin selects the ``block'' (paragraph, row, row group, table) which is in front of the click. In this case, this selects the `li`. Click again without moving the mouse and this will select the parent of the `li`: the `ul`. Clicking again without moving the mouse would select the parent of the `ul`: the `body`, and so on. Do not click several times too fast otherwise the editor will think you are double-clicking or triple-clicking and therefore, selecting elements that way would not work.

### Note

Because this way of selecting blocks is so easy to use, it tends to ``cannibalize'' the other ways of selecting nodes, especially the implicit element selection. Therefore we do not recommend turning on this option.

## 10. Quickly insert ``XML variables'' in your document using the Include tool

You'll often want to put all the ``XML variables'': product names, product versions, copyright information, addresses, phone numbers, etc, you use in all your documents in a single, special purpose, document and then, paste references to these ``XML variables'' in your actual documents.

By working this way, if one day, the value of an ``XML variable'' changes, you don't need to manually update all the documents making use of this value.

In Extensive use of the "Copy as Reference" command, we have already explained that this is done by copying an element from the document containing the collection of ``XML variables'' (using Copy As Reference — Ctrl-Shift-C) and then pasting the reference in the actual document (using Paste — Ctrl-V).

However if you need to do that one hundred times a day, you'll quickly find very tedious switching from one document to the other. Fortunately, the Include tool has been specially designed to handle the case of ``XML variables''.

Let's suppose you want to use the Include tool to insert in your report the VAT rate of Germany (same example as in Extensive use of the "Copy as Reference" command). Here's what you'll have to do:

1. Use the button to specify once for all the filename or URL of the document containing your collection of ``XML variables''. In the above screenshot, this document is `VATrates.html`.

2. Use Edit|Reference|Insert Reference (Ctrl-Shift-R) to display the Include tool.

3. Type the ID of the element for which you want to insert a reference. Typing the first few letters is generally sufficient as the "Element having ID" text field supports auto-completion.

4. Press Enter.

That's it. You have inserted a reference to the `span` element containing the VAT rate of Germany.

### Use the right tool for the right job

For example, do not attempt to use the Include tool to compose a modular book. Inserting references to the chapters in the modular book is best achieved by using the Copy As Reference/Paste (Ctrl-Shift-C/Ctrl-V) approach described in the tutorial.

The Include tool is present only in XMLmind XML Editor Professional Edition.

Prev |  |
Chapter 3. Tutorial: creating a modular document | Home |