[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: key with restricting the scope of use attribute

Subject: Re: key with restricting the scope of use attribute
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 11 May 2001 13:36:05 +0100
Re:  key with restricting the scope of use attribute
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.