The XSLT specification was designed with several goals in mind. First, the XSLT stylesheet itself is an XML document. This allows you to manipulate the stylesheet like any other XML document, up to and including transforming the stylesheet itself into another format via XSLT.
Next, the XSLT language is based on pattern matching. In fact, much of the pattern matching power of XSLT comes from the XPath specification, which is discussed in Chapter 6.
Third, like any good functional programming language, each XSLT function is free of side effects. The benefit this design goal creates is that the same function will have the same effect on any source node on which it is invoked, no matter how many times it has already been invoked on that or any other node.
Finally, flow control in XSLT is managed
through iteration and
recursion. The concept of iteration will be
familiar if you’ve used C#’s
foreach statement. The idea is that, given a
collection of nodes, the same set of functions will be applied to
each one in order. Recursion should also be familiar to developers
experienced with modern programming languages; a recursive function
is one that calls itself during its execution.
XSLT processing consists of loading an XML source document into a source tree, applying a series of templates to the nodes in the source tree, and sending the resulting data to a result tree. Where the source document comes from, and where the result document is ...