Given this XML:
<Table>
<ID>3589</ID>
<Type>Change Request</Type>
<Version>1</Version>
<Summary>...</Summary>
</Table>
<Table>
<ID>3596</ID>
<Version>1</Version>
<Type>Change Request</Type>
<Summary>...</Summary>
</Table>
<Table>
<ID>4818</ID>
<Type>Bug</Type>
<Version>1</Version>
<Summary>...</Summary>
</Table>
<Table>
<ID>4819</ID>
<Type>Bug</Type>
<Version>1</Version>
<Summary>...</Summary>
</Table>
<Table>
<ID>4820</ID>
<Type>Bug</Type>
<Version>2</Version>
<Summary>...</Summary>
</Table>
I use this XSLT:
...
<xsl:for-each select="//Table[Version=$vn]">
<xsl:sort select="Type" />
<xsl:variable name="currentType" select="Type" />
<xsl:if test="not($currentType=preceding-sibling::Table/Type)">
<h2><xsl:value-of select="Type" /></h2>
</xsl:if>
<p><b><xsl:value-of select="ID" /></b>:<xsl:value-of select="Summary" /></p>
</xsl:for-each>
...
What test do I need to use to only show Type when it changes? I only want te first occurence to show. Right now preceding-sibling::Table/Type always refers to the first ‘row’
The transformation is done in C#.
How about this: