RE: [xsl] Using keys in templates

Subject: RE: [xsl] Using keys in templates
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 13 Jul 2004 17:37:52 +0100
> It's almost always better to specify exactly which nodes you want to
> process in an <xsl:apply-templates select=""/> then to either use ifs
> inside a template or a match on a template.

I don't agree. For example, the problem of deleting selected nodes from a
tree is best solved by using the identity template to apply templates to all
nodes in the tree, and then defining a "do nothing" template rule to process
the exceptions. The "push" model is useful because the rules for processing
each kind of node are associated with that node, and not with each of its
possible parents, and this applies just as much when the required action for
some kinds of nodes is a no-op.

Michael Kay

Current Thread