[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
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|