Input XSLT Output

select vs: match

This example illustrates two ways to select specific Elements (in this case, the <Object> Elements).

The first method uses the select of the apply-templates to extract the desired Elements.

The second method selects all descendant nodes and the sub template matches the desired ones. (The mode Attribute in the apply-templates and sub templates keep the Test1 and Test2 behavior separate.)

Note that we need to provide a second template to match any nodes selected by apply-templates that our sub template does not match. If we don't, the default templates are applied, and the Text Nodes “leak” through.