Similar to EG103 and EG104, but this time with multiple apply-templates,
each using a different select
value.
There are also three sub templates, each with a different
match
value.
The three sub templates are designed to match the three basic node types:
(Element, Attribute, Text).
For now the sub templates just list (by creating an Element) the node they matched. (Later examples will explore the possibilities of sub templates.)
Note that the the selection/matching process “passes” entire tree fragements.
For example, when the Test3 apply-templates
selects Elements named “Object”,
the node set that is the result of the select include all descendant nodes.
Test1 shows how apply-templates
with no select
attribute,
selects child Element and Text nodes (but not Attribute nodes).
Test2 uses select="child::*"
to select only the child Element nodes.
(Using select="*"
would be the same.)
Note that having no select
Attribute is the same as having
select="*|text()"
.
Test3 selects all descendant Element nodes named “Object”.
Test4 selects all Attribute nodes in the document.
It is the only version of apply-templates
that does.