Forum Moderators: open
...
<stat>
<overview>
<tools>
<item resp="abc"><link id="...">Item 1</link></item>
<item resp="abc"><link id="...">Item 2</link></item>
<item resp="abc"><sub><link id="...">Item 3</link></sub></item>
</tools>
<tools>
<item resp="abc"><link id="...">Item 4</link></item>
<item resp="abc"><sub><link id="...">Item 1</link></sub></item>
</tools>
<tools>
<item resp="abc"><link id="...">Item 1</link></item>
<item resp="abc"><link id="...">Item 5</link></item>
</tools>
</overview>
</stat>
<ul>
<xsl:for-each select="//overview/tools//item[contains(@resp,$role)]">
<xsl:apply-templates select="."/>
</xsl:for-each>
</ul>
<xsl:for-each select="//overview/tools//item[contains(@resp,$role) and not(text() = preceding::item[contains(@resp,$role)]/text())]">
<xsl:apply-templates select="."/>
</xsl:for-each>
source [jguru.com]
<xsl:template match="@*|node()">
<xsl:if test="not(node()) or not(preceding-sibling::node()[.=string(current())])">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:if>
</xsl:template>