using preceding-sibling in apply-templates subset
I'm using apply-templates to get a subset of my nodes. Then I'm using the position() function to get my position within the subset, which is working fine. Then I try to use that position() to get the value of the previous node: position()-1, but instead of looking within my subset, it goes out to the entire xml and starts looking starting at the root node. How do I find the value of the previous node when I'm within a subset of nodes?
First I did a template match:
<xsl:template match="my:Criteria" mode="xd:preserve">
Then I wanted to check if a value I have in the current context node is the same as the value I had in the previous context node:
<xsl:value-of select="preceding-sibling::my:Criteria/my:Level2"/>,
but although my:Level2 DOES change, the output from this statement never changes. It always seems to be going back to the parent data instead of the subset I have within my template match. This is driving me crazy, and any help would be most appreciated!
|