The XSLT Process Model
XSLT comes with a full-fledged set of instructions that enable you to use it almost like a programming language of its own. Conditional statements, variables, parameters, and loops exist, just as you would expect in any programming language. Obviously, XSLT is geared more to do transformations than to write general-purpose programs, but its rich instruction set makes it a powerful tool, indeed.The various instructions you can use in XSLT, their syntax, and a brief explanation of what they do are described in the next few sections.
<xsl:apply-imports/>
This instruction, when encountered while processing a node within a template, directs the processor also to apply template rules imported into the stylesheet on that node. It has no attributes or content.
<xsl:apply-templates>
The following instruction directs the processor to instantiate a template that matches the XPath expression given by the value of the select attribute. In the absence of a select attribute, the instruction processes all the children of the current node, including text nodes. The optional mode attribute can be used to specify the mode of the template to be used if a conflict occurred. This instruction can also be made to pass parameters to the template being instantiated (using xsl:with-param) and change the order of processing the selected nodes (as given by xsl:sort):
<xsl:apply-templates select = node-set-expression mode = qname>
<!–– Content: (xsl:sort | xsl:with-param)* ––>
</xsl:apply-templates>