Re: [xsl] The identity transform and attributes

Subject: Re: [xsl] The identity transform and attributes
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 21 Jan 2008 17:35:23 GMT
>  So when you have:
> 
> match="foo"
> 
> you really have:
> 
> match="child::foo"
> 
> ...to distinguish between foo being an attribute or element?  The same
> logic applies to node() in that:
> 
> 
yes.

> the real mind bender is:
> 
> apply-templates select="parent::foo"
>
> being matched by:
> 
> template match="child::foo"
> 
> Is that clear is anyones mind?

There's no direct relationship between the form of the XPath expression
used in a select attribute and the form of an XSLT pattern used to match
the nodes.

a node might be selected by 
select="foo" or 
select="parent::foo" or 
select="key('wibble','wobble')
it really makes no difference. The criterion for deciding whether a node
is matched by a particular pattern only involves the node and its
location in the current document, the expression used to select the node
is simply not consulted during the matching process.

select="child::foo selects the parent of the current node, 
 match="child::foo" asks if that node is the child of anything.
So unless you find it surprising that something can both have a parent
and be a parent, I'm not sure what is surprising here? 

David


________________________________________________________________________
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