Attribute selector

This field allows the mapping to be based on the value of a single attribute. Enter the attribute exactly as it would appear in the tag itself. You may omit the quote characters in the value you type; TopLeaf will insert them for you. The resulting mapping will display the attribute selector in brackets, as in:

section/note[style="editorial"]

The selector path can also be used to reference an attribute from an ancestor tag. The following options are allowed:

  • tag@attribute="value" — starting from the parent tag, the closest ancestor named tag is located; the mapping is selected if the named attribute in this tag has the specified value.

  • ../attribute="value" — the mapping is selected if the named attribute in the parent tag has the specified value.

  • ../../attribute="value" — the mapping is selected if the named attribute in the grandparent tag has the specified value.

Note that the selector will also match missing attributes, using the default value specified in the DTD. If no default has been specified, then the attribute is assigned the value #IMPLIED. This is a literal string which can be matched if required.

Complex selections based on attributes (for example whether an attribute is greater or less than a given value) can be processed using custom markers. These selections are made via the Custom tab (see in particular the sections on attribute variables and flow control).

Mappings with attribute selection have a higher precedence than mappings without. See “Priority and Precedence” for details.