Contents
Index
Search

11. Element templates

You'll find in the command parameters of the above toolBar, in some cases, element qualified names such as {http://www.xmlmind.com/ns/sect}table and in other cases, references to elements templates, such as #template({http://www.xmlmind.com/ns/sect}table,header).

The later notation means:

  1. it's an element template;

  2. this is a template for element {http://www.xmlmind.com/ns/sect}table;

  3. the name of the element template is "header".

Note that element templates are uniquely identified by the combination element name/template name, and not by the template name alone.

Why specify element templates in your configuration file? By default, XXE creates the simplest possible, valid, element. For example, in the case of a table, this simplest possible, valid, table has just one tableRow, containing just one tableCell. In the case of a table, this is too simple to be really useful. On the contrary, we want a table to contain by default 2 rows, each row containing 2 cells. We also want to have a number of predefined table templates easily available, for example, a table having a header row. All this can be specified using the elementTemplate configuration element.

Excerpts from rng_section_config/common.incl (same file for all variants):

<elementTemplate name="rows2" selectable="override">1
  <table xmlns="http://www.xmlmind.com/ns/sect">
    <tableRow>...ELIDED...</tableRow>
    <tableRow>...ELIDED...</tableRow>
  </table>
</elementTemplate>

<elementTemplate name="header">2
  <table xmlns="http://www.xmlmind.com/ns/sect">
    <tableHeader>...ELIDED...</tableHeader>
    <tableRow>...ELIDED...</tableRow>
    <tableRow>...ELIDED...</tableRow>
  </table>
</elementTemplate>

<elementTemplate name="image" selectable="false">3
  <paragraph xmlns="http://www.xmlmind.com/ns/sect"><image source="???"/></paragraph>
</elementTemplate>

1

Attribute selectable="override" means: use this template instead of the 1 row/1cell table generated by default by XXE. This also implies that this element template will be listed simply as "table", and not as "table(rows2)", in the Edit tool in XMLmind XML Editor - Online Help.

2

The default value of attribute selectable is true. This makes the corresponding element template available for the Edit tool. In the above case, this element template will be listed as "table(header)".

3

Attribute selectable="false" means: do not make this element template available for the Edit tool, as it is just needed here in this configuration file (i.e. in a menu, toolBar, macro, etc).