First of all thank you to everyone who replied in my previous thread. In the interest of avoiding confusion I am posting similar information here, but questions updated accordingly.
My problem is that my xsl for-each shown below never gets executed, indicating that there is nothing in the result set. However, I cannot figure out why. Further description below.
Input structure
<AllMyResults>
<Result>
<someElement>value</state>
<otherElement>value 2</state>
<subject>Get unique subjects!</state>
</Result>
</AllMyResults>
At the top of my XSL file I have the key statement
<xsl:key name="SubjectKey" match="All_Results/Result" use="subject"/>
[2] The meat of my XSL file, which uses a different input structure:
<xsl:for-each select="$ResultSet/subject[
generate-id()
= generate-id(key('SubjectKey', 'subject')[1])
]">
... this point is never reached ...
</xsl:for-each>
Input structure used by [2] above The input structure is just a list of elements.
What am I missing here? I used a debugger to determine that the for-each was never executed, which indicates that the set generated by the expression $ResultSet/subject[generate-id() = generate-id(key('SubjectKey', 'subject')[1])] was the empty set. But why?
Additional Info
$ResultSet is a node set. It was a parameter passed in to the template. According to my debugger, the "key" statement gets executed the appropriate amount of times -- once per time a "subject" shows up in my input file. According to what I've read about generate-id(), with no params, it operates on the current node. Instead of $ResultSet/subject I've also tried all sorts of variations. ($ResultSet/*/subject, $ResultSet/*, etc)
Resultelements in key declaration... - user357812