ZVON > > Templatotron
tutorial | contents | introduction | >> reference << | download |

Templatotron reference

Namespaces

http://zvon.org/templatotron (prefix "t" in this documentation)

used both for elements and attributes, many templatotron templates will use only this namespace

http://zvon.org/templatotron/instruction (prefix "ti" in this documentation)

used only for elements which specify some templatotron instructions (e.g. ti:empty, ti:key)

http://zvon.org/templatotron/namespace (prefix "tn" in this documentation)

Element tn:namespace and attributes from this namespace set namespaces for elements and attributes in the output, respectively.


Elements

match = "*"
Elements from non-templatotron namespaces are copied to the output together with their attributes (with possibly changed values, see below)
match = "@t:*"
Values of these attributes are XPaths. For each attribute from "http://zvon.org/templatotron" namespace is created an attribute with the same local name and with its value set by an evaluation of the XPath.
match = "@tn:*"
Its value is a namespace. If there is an attribute "t:*" with the same local-name, than this attribute is cast to this specified namespace.
match = "t:*"
Elements from "http://zvon.org/templatotron" namespace create elements on the output from the namespace of their nearest non-templatotron ancestor if there is no tn:namespace attribute. The algorithm of output element creation is determined by attributes (see below)
match = "@t:select"
An XPath returning a node-set. Number of outputted elements is equal to the number of the selected nodes.
match = "@t:value-of"
A general XPath. If this attribute is used, the text content of the outputted elements is set to its XPath evaluated result.
match = "@t:*"
A general XPath. It creates variables with names equal to the local-name of the attribute and with values set to XPath evaluated result. The variable names must be unique in the template. The names "select" and "value-of" are reserved (see above).
match = "@*"
It creates attributes of the same name on the outputted elements. The sections of its value enclosed by "{...}" are evaluated as in XSLT.
match = "@tn:namespace"
The value of this attribute is a namespace. The element outputted is cast to this namespace.
match = "ti:*"
Elements from "http://zvon.org/templatotron/instruction" namespace are ti:empty and elements with functionality similar or equivalent to XSLT.
match = "ti:empty"
By default the elements created with t:* elements uses t:select matched values for their content. In some cases only an element should be created without content. In these cases ti:empty indicates this aim.
match = "ti:key"
It has the usage equivalent to XSLT specification, but it can be defined anywhere in the template.
match = "ti:if | ti:choose | ti:when | ti:otherwise"
Their usage is equivalent to XSLT specification.
match = "ti:output"
Its usage is equivalent to XSLT specification. This element can occur anywhere in the template, if there are several output elements the first instance in document order is considered.
match = "ti:...."
To use of other XSLT elements should be investigated on individual basis.