xsl-list
[Top] [All Lists]

Re: xsl:key only checks first child, need to check all

2005-11-08 00:09:19
Patrick Warren wrote:

Thanks David. That does just what I wanted. Now generate-id finally makes more sense to me. I got rid of all the // in my stylesheet, since your example showed me well how to use the keys I had set up.

The only thing I don't understand is why you don't use a [1] in order to get the first member of the key:

[generate-id()=generate-id(key('topics',.)[1])] instead of:
[generate-id()=generate-id(key('topics',.))]

I mean, it works how you have it, but I don't get why you don't need to use it.
What exactly is your expression doing?


The definition of the function generate-id() says:

http://www.w3.org/TR/xslt#function-generate-id

"The *generate-id <http://www.w3.org/TR/xslt#function-generate-id>* function returns a string that uniquely identifies the node in the argument node-set that is first in document order."

So the processor is using the first node, no matter how nodes are in the node-set, making the positional predicate unnecessary. Many XPath and XSLT functions that accept a node-set have this behavior.

Dave

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>