Answering a large number of XSLT questions here in Stack Overflow, I am more than familiar with Muenchian grouping technology for grouping nodes during XSL conversion.
The expression used in it usually looks something like this:
*[generate-id() = generate-id(key('kSomeKey', .)[1])]
It almost always contains that [1] , but it always struck me as odd.
The XSLT 1.0 specification defines generate-id() as follows:
The generate-id function returns a string that uniquely identifies the node in the node -set argument, which is first in document order .
(in italics)
It clearly states that the function works with the first node in document order, and in this context [1] will select the first node in the set in document order, so it seems that [1] is redundant.
This [1] used so widely that I hesitate to skip it, but it seems to be an outsider. Can anyone clarify this for me?
source share