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

Re: [solved] key with many uses's

Subject: Re: [solved] key with many uses's
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 7 Feb 2002 10:57:37 +0000
solved 2.0 key
Hi Elizabeth,

> Try this:
>
> <xsl:for-each select="$nodes[generate-id(.) =
> generate-id(key('special-phones', string(@description, @paren,
> @description-place))[1])]">

I think you meant concat() rather than string() there? The string()
function can only take one argument. concat() will concatenate
the values of the @description, @paren and @description-place
attributes together into one long string, which will be different for
every combination of @description, @paren and @description-place.

> Why does this work as opposed to
>
> <xsl:for-each select="$nodes[generate-id(.) =
> generate-id(key('special-phones', @description | @paren |
> @description-place)[1])]">

@description | @paren | @description-place creates a node set of (up
to) three nodes - description, paren, and description-place
attributes. When the second argument to key() is a node set, it's
equivalent to calling the key with the string values of each of those
nodes individually, and unioning the results together. In other words:

  key('special-phones', @description | @paren | @description-place)

is roughly equivalent (assuming that all three attributes are present)
to:

  key('special-phones', @description) |
  key('special-phones', @paren) |
  key('special-phones', @description-place)

So what the key returns is a set of nodes that share *any* of the
values of @description, @paren, @description-place with the node
you're looking at (compared to with concat(), where you get those
nodes that share *all* the values). Which is why it doesn't work.
  
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.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.