The main template determines the structure of the output. This means that the sequence in which the main template is laid out in the design is the sequence in which the output is laid out. In programming jargon, this is procedural processing. Processing starts at the beginning of the template and proceeds in sequence to the end. Along the way, nodes from the XML document are processed. The templates which process these nodes are called local templates. After a local template is processed, the processor moves to the next component in the main template, and so on. Occasionally, a node may reference a global template for its processing. In such cases, after the global template is executed for that node, the processor returns to the position in the main template from which it branched out and continues in sequence from the next component onwards.
The entry point for the main template is the document node of the schema. StyleVision offers the option of selecting multiple root elements (document elements). This means that within the main template, there can be local templates for each of the active document elements. The one that is executed during processing will be that for the element which is the document element of the XML instance document being processed.