Re: [xsl] Identifying unique attribute values in nested sibling elements

Subject: Re: [xsl] Identifying unique attribute values in nested sibling elements
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Thu, 29 Sep 2011 12:53:40 +0200
Mark wrote:
I apologize, I meant to include that information - I am using XSLT 2.0.

Then you should be able to easily nest two for-each-group group-by


<xsl:template match="Set">
<xsl:for-each-group select="Stamp" group-by="Formats/@se-tenant">
<xsl:for-each-group select="current-group()" select="string-join(Value/@*, '|'">
<!-- now the first Stamp in each group is simply . e.g. -->
<xsl:value-of select="./Value/@*/concat(local-name(), '=', .)" separator=" "/>
<br/>
</xsl:for-each-group>
</xsl:for-each-group>
</xsl:template>


<Set>
<!--possibly other unrelated <Stamp> elements here-->
<Stamp>
<CatNumbers pofis-number="1"/>
<Value kc-value="14"/>
<Formats se-tenant="1"/>
</Stamp>
<!--possibly other unrelated <Stamp> elements here-->
<Stamp>
<CatNumbers pofis-number="2"/>
<Value kc-value="18"/>
<Formats se-tenant="1"/>
</Stamp>
..... <!--possibly other unrelated stamp elements-->
<Stamp>
<CatNumbers pofis-number="3"/>
<Value kc-value="18" h-value="50"/>
<Formats se-tenant="1"/>
</Stamp>
<!--possibly other unrelated <Stamp> elements here-->
<Stamp>
<CatNumbers pofis-number="4"/>
<Value kc-value="14" />
<Formats se-tenant="1"/>
</Stamp>
<!--possibly other unrelated <Stamp> elements here-->
<Stamp>
<CatNumbers pofis-number="5"/>
<Value kc-value="0" l-value="A" />
<Formats se-tenant="1"/>
</Stamp>
</Set>




--

	Martin Honnen --- MVP Data Platform Development
	http://msmvps.com/blogs/martin_honnen/

Current Thread