2013-11-21
In general, XSLT templates are representations of contingency (when this node is matched, do this); our use of predicates in the previous examples demonstrates this. However, there are cases where it is inconvenient to use these kinds of tests: where we want instead to be able to say within a single template when A, do a; when B, do b
Examples:
Each example accomplishes the same thing. Whether you use one or the other is a matter of preference or convenience. It is possible that one is faster than the other using a particular XSLT engine; but the other might be faster than the one using a different XSLT engine. And the difference is probably infinitesmal, anyway.