|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: [solved] key with many uses's
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
|
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
|

Cart








