I'm new to XPath expressions in XSLT and have hit my head against the desk for too long. I'd like to evaluate a sibling node within the first preceding ancestor of the current node and test if that node is the same.
Here's my XML:
<item>
<number>1.0</number>
<category>Data</category>
<functionality>Search Screen</functionality>
<requirement_type>SIT</requirement_type>
<table>Table</table>
</item>
<item>
<number>1.1</number>
<category>Data</category>
<functionality>Search Screen</functionality>
<requirement_type>SIT</requirement_type>
</item>
Here's my XSLT:
<xsl:for-each select="item">
<xsl:if test="not(preceding-sibling::*[position()=1])">
<xsl:value-of select="category"/>
</xsl:if>
</xsl:for-each>
Essentially, I'm trying to test whether the <category>
child node of the the second <item>
node is the same as the <category>
child node of the the first <item>
node.
Searching similar StackOverflow questions gets me close, but just not there ....