XSL processors do parses the XML source and tries to find out the matching template rule.
If it do find it, then the instructions inside the matching template is evaluated.
A D V E R T I S E M E N T
XML source
<?xml version="1.0"?>
<xslTutorial >
<bold>Hello, world.</bold>
<red>I am </red>
<italic>fine.</italic>
</xslTutorial>
HTML output 1
<P>
<B>Hello, world.</B></P>
<P style="color:red">I am </P>
<P>
<i>fine.</i></P>
Parts of the XML document to which the template should be applied are been determined by
the Location Paths. A required syntax is specified in XPath specification. Simple cases
do look similar to the filesystem addressing. see Stylesheet 1
The Processing always do starts with the template match="/" . This is a root element
and its only child is the document element, in our case it is XSl Tutorial. Many
of the stylesheets do not contains this element explicitly. When the explicit template
does not exist implicit the template, which do contains the instruction is called.
This means: It processes all the childrens of the current node, including the text nodes.
Wildcard
A Template can do match from the selection of a location paths, individual paths being
separated with the "|". (see Stylesheet 1). The wildcard * selects all the possibilities.
Compare the Stylesheet 1 with the Stylesheet 2.
Modes in XSL do allow the element to be processed for multiple times, each time producing
different result. In the Stylesheet 2 one of the modes do not exist.
Very often several of the templates do match the selected element in the XML source. It
should be therefore decided which one to use. Templates are been ordered according to
their priority which can be specified with the priority attributte. If a template do
not contain this attribute, its priority is been calculated according to several rules.