Section 2.4: Executing a Transformation

Section 2.4: Executing a Transformation

This section is a mess; it's a relic of the past. I don't think that there's anything it says that is actually wrong, but it's a ragbag of information and some of it is misleading if read out of context, some of it is tutorial that's no longer needed, and some is redundant with section 2.3.

Remember that section 2 is called Concepts; it's not supposed to be defining all the detailed rules.

I would like to replace it with two sections as follows:

2.4 Instructions

The main executable components in a stylesheet are templates and functions. The body of a template or function is a _sequence constructor_.

(Then take the existing content of 2.4 from "A sequence constructor is..." to the end, except for the last paragraph).

2.5 Rule-Based Processing

The classic method of executing an XSLT transformation is to apply template rules to the root node of an input document (see 2.3.3 Apply-Templates Invocation <https://www.w3.org/XML/Group/qtspecs/specifications/xslt-30/html/Overview-diff.html#invoking-initial-mode>). The operation of applying templates to a node searches the stylesheet for the best matching template rule for that node. This template rule is then evaluated. A common coding pattern, especially when XSLT is used to convert XML documents into display formats such as HTML, is to have one template rule for each kind of element in the source document, and for that template rule to generate some appropriate markup, and to apply templates recursively to its own children. The effect is to perform a recursive traversal of the source tree, in which each node is processed using the best-fit template rule for that node. The final result of the transformation is then the tree produced by this recursive process. This result can then be optionally serialized (see 2.3.6 Post-processing the Raw Result <https://www.w3.org/XML/Group/qtspecs/specifications/xslt-30/html/Overview-diff.html#post-processing>). 
(existing para 2) [Definition: A stylesheet contains a set of template rules (see  <>6 Template Rules <https://www.w3.org/XML/Group/qtspecs/specifications/xslt-30/html/Overview-diff.html#rules>). A template rule has three parts: a pattern <https://www.w3.org/XML/Group/qtspecs/specifications/xslt-30/html/Overview-diff.html#dt-pattern> that is matched against nodes, a (possibly empty) set of template parameters <https://www.w3.org/XML/Group/qtspecs/specifications/xslt-30/html/Overview-diff.html#dt-template-parameter>, and a sequence constructor <https://www.w3.org/XML/Group/qtspecs/specifications/xslt-30/html/Overview-diff.html#dt-sequence-constructor> that is evaluated to produce a sequence of items.]In many cases these items are newly constructed nodes, which are then written to a result tree <https://www.w3.org/XML/Group/qtspecs/specifications/xslt-30/html/Overview-diff.html#dt-result-tree>.

(Now add a simple but complete example of a simple XML-to-HTML transformation implemented using recursive template rule processing).

Received on Friday, 4 March 2016 09:57:18 UTC