Re: [xsl] Problem with xsl:template using XSLT 1.0

Subject: Re: [xsl] Problem with xsl:template using XSLT 1.0
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 4 Dec 2007 11:31:44 GMT
> I kind of understand what Scott means but I'm not sure I agree - in
> the above example doesn't the template match pattern in the latter
> method give you same level of context as the select in the former?

I think that what Scott was refering to is (for example) relying on
context such as the current node.

<xsl:apply-templates select="some-nodes[some-filter]"/>


<xsl:apply-templates select="some-nodes"/>
<xsl:template match="some-nodes"/>
<xsl:template match="some-nodes[some-filter]">....

may be sort of equivalent (modulo use of position() ) if some-filter is
fixed, but often it depends on a local xpath

<xsl:apply-templates select="some-nodes[@id=current()/@id]"/>

for example can't so easily be moved down on to the match.

Looking down my stylesheets I seem to use both ways (and for-each (and
more and more, for-each-group) in about equal measure.


The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 

Current Thread