[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: Dan Diebolt <dandiebolt@xxxxxxxxx>
Date: Fri, 11 May 2001 05:02:10 -0700 (PDT)
dan diebolt
M>There's some basic misunderstanding here about what a key is.
M>Think of <xsl:key> as being like "create index" ...
M>it doesn't make sense to
M>change them depending on the contents of a variable.

I didn't know precisely when the key became "fixed" but
I am not trying to alter the key definition dynamically. 
I am trying to create a set of similar keys parameterized 
by the node I am visiting.

I need to traverse a set of nodes (//a/b) and at each node 
do some heavy processing involving repeated evaluation of 
a key to process other nodes (more or less underneath 
the node I am  visiting). At each node, lets say I need to
retrieve nodes associated with the combined value of @x and
@y. But I want to restrict the nodes returned by key() to those 
associated with the current node that I am visiting. So I
take the approach of building the use attribute from *three* pieces
of information @x, @y and something unique to the $CurrentNode
namely generate-id().

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)"/>
               ^^^^^^^^^^^^^

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

It appears to work, but I am a little uncertain if this is the
best appraoch to implement with. So I am asking for comments and
alternate suggestions.

Regards,

Dan

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

 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.