2. How does this really work?
Prev | Chapter 2. Tutorial | Next

## 2. How does this really work?

In XMLmind XML Editor, a formula is stored as the `xxe-formula` processing instruction. A processing instruction such as `xxe-formula` is allowed by the XML standard. Such processing instructions will be ignored by all XML software except XMLmind XML Editor.

Unlike in ``real'' spreadsheet software:

- A formula is not a ``computed table cell'', which is itself a value you can reference in other formulas. A formula is a special XML object which can be inserted anywhere in the XML document (including inside a table cell element, at an arbitrary nesting level).

- A formula computes a value, but is not itself a value you can reference in other formulas. This computed value is added just after the `xxe-formula` processing instruction. If there is already some text just after the `xxe-formula` processing instruction, this text is replaced.

  Optionally the computed value can be used to set/replace the value of an attribute of the element containing the `xxe-formula` processing instruction.

- A formula can access any part of the XML document (using XPath escapes). When the formula has an ancestor element which is formatted as a table cell, using the customary A1 notation to reference table cells is possible. When no styled view is used to render the XML document or when the formula has no ancestor element which is formatted as a table cell, A1-style cell references will not work.

In a styled view, a formula is rendered using a special purpose gadget, which is at the same time an indicator and a button. Its color gives you a hint about the state of the formula.

Icon | Description
--- | ---
| Unknown state. Formulas contained in document modules included in the document being edited are ignored by the spreadsheet engine.
| Parse error. Should not happen if you use the Formula Editor.
| Evaluation error.
| OK.
| Disabled. Disabling a formula means passivating it. That is, it is no longer used to update the document. In some cases, this is a handy alternative to removing it.

Clicking on the icon triggers special actions:

Simple click

  If the formula cannot be parsed (red icon) or evaluated (orange icon), displays the corresponding error message in the status bar. If the formula is working, displays the last statement of the formula (a formula can contain several statements, see The language used to write formulas).

Double click

  Opens the Formula Editor to edit the formula.

Click with middle button

  Disables (gray icon) or enables (green icon) the formula.

Prev | Up | Next
1. Basics | Home | 3. Relative references