Input XSLT Output

Sub Template Selection & Matching

The first example of the 200 Series introduces a more complex XML input file, so we re-visit a version of EG105. In the earlier example, we introduced the idea of sub templates with match values that matched nodes sets from apply-templates.

In this example, multiple apply-templates select various node sets for processing. The different match values in the sub templates control which template is applied. As in EG105, three sub templates match the three basic Node types: Elements, Attributes and Text.

Test1 selects all document Element nodes, while Test2 selects all the Attribute nodes.

Test3 selects both Element and Attribute nodes (using the “|” delimiter). Note the different Element and Attribute selection syntax. This is just a different way of spelling 'all descendant Elements/Attributes'.

Test4 selects Text nodes.