Re: [xsl] key with restricting the scope of use attribute

Subject: Re: [xsl] key with restricting the scope of use attribute
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 11 May 2001 13:36:05 +0100
> I am trying to create a set of similar keys parameterized 
> by the node I am visiting.

key generation happens (conceptually) first, before the stylesheet
starts. 


This is why I need to build the use key having part of it derived 
from the current node:

<xsl:key name="MyKey" match="a/b" 
   use="concat(generate-id(),':',@x,':',@y)"/>
               ^^^^^^^^^^^^^


But the current node in the use attribute is the node that's matched
by the match attribute
so by doing that you make the key essentially useless don't you?
In order to call key() you'll need to be at the correct node already
and so the key will just return you to where you are.


<xsl:key name="MyKey" match="a/b" 
   use="concat(generate-id(),':',@x,':',@y)"/>
               ^^^^^^^^^^^^^

<xsl:for-each select="key('MyKey',
   concat(generate-id(),':',$xyCombo))">
          ^^^^^^^^^^^^^                        

If the current node is a b node with an a parent then
key('MyKey',
   concat(generate-id(),':',$xyCombo))
will produce a node set consisting of at most the current node
(if $xyCombo is the concat of the current x and y attributes)
or the empty node set otherwise.

If the current node isn't a b then it will return the empty node set.

So the for-each never seems to do anything much.

I'm not clear what you are trying to do.

David


_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Scanning Service. For further information visit http://www.star.net.uk/stats.asp

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread