XML Script logo
Command _template
Attribute

file, a string

[optional] the file to retrieve the template from.

Attribute

name, a string, defaults to 'default'

[optional] the template name.

Description

Marks its content as a template, which is identified by its 'name' attribute. A template is a piece of code which is used to process certain data elements. The <_method /> tag, which is used to associate a given template with a given element, must always be placed after the definition of the template in a given piece of code. Template code is only executed when an associating method has been invoked, such as by the <_process /> tag. During execution of a template, the current root is set to point at the element which the template is currently processing. The data root is always accessed using '\'. A template can also be loaded from a file by specifying the file in the file attribute. The method finds the correct template by matching its name attribute with the template's. Previously, when used with the file attribute, _template used the first template in the file, if _template cannot find a template of the given name it will revert to this behaviour to ensure backwards compatibility.

Examples of use

                                
                        

XML Script homepage | Documentation home | XML Script docs | Command list | Function list | X-Tract docs

X-Stream, X-Tract and XML Script are trade marks of DecisionSoft Limited
© Copyright 1998-2000 DecisionSoft Limited