Attribute variables

An attribute variable name is defined as the name of the corresponding attribute in the current start tag preceded by @. Attribute variables may be referenced from within start tag custom content, end tag custom content, or properties within the current mapping that permit the use of variable references.

Attribute variables are specific to a single mapping and refer only to the tag or marker currently being mapped. The value of an attribute variable is fixed for the duration of that mapping and may not be directly altered by the user. If you need to reference the value in a different mapping, you must copy the value to a user variable (see “The <set/> command”).

Attribute variables are implicitly stacked. For example, if a listitem contains another listitem then the attribute variables in the custom content will always refer to the value declared in the currently mapped tag.

Default or implied values

The treatment of attributes not explicitly declared in a tag or custom marker is as follows:

  • When mapping a tag declared in a DTD any absent attributes will take on their specified default values. It is an error to refer to an attribute not defined in the DTD.

  • If TopLeaf cannot locate a document type declaration when it composes a partition, any attribute not explicitly present in the tag is assumed to have the value #IMPLIED. This is a literal string that can be tested in the normal manner.

  • All attributes referenced from within a custom marker mapping must be within the marker. The value of an undeclared custom marker attribute is undefined and will generate an error when first referenced. Subsequent attempts to reference an undefined custom marker attribute will return the value #IMPLIED.

Namespaces

Where a document uses namespaces any namespace prefix is considered part of the attribute name. For example: when the tag

<link tks:dest="ah17a"/>

is mapped the attribute variable {@tks:dest} contains the string ah17a.