Re: [xsl] understanding key usage

Subject: Re: [xsl] understanding key usage
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 22 Nov 2004 12:34:43 GMT
   Hi,

   is there a difference between the following?

   <xsl:key name="dkey" match="B" use="key"/>
     <xsl:for-each select="value/B[generate-id()= generate-id(key('dkey','USD')[1])]">

   and 

   <xsl:for-each select="value/dovizler[key='USD']">

   in my opinion, both of these correspod to B elements whose 'key' values are equal to 'USD'.

   any ideas?
   regards.

They are very different. For example:
The first one selects B elements and the second one selects dovizler
elements.

The first one selects at most one node.
If there is a value child of the current node that has a B child, and
that B child is the first B element in the current document to have a
key with value USD then that B element is selected, otherwise the empty
set is returned.



The second one selects all dovizler children of value children of teh
currentnode that have a key child with value USD.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread