<ROOT>
<AA Aattr="xyz1">
<BB bAttr1="firefox" bAttr2="aaa" >
</BB>
<BB bAttr1="chrome" bAttr2="aaa" >
</BB>
<BB bAttr1="firefox" bAttr2="bbb" >
</BB>
<BB bAttr1="chrome" bAttr2="bbb" >
</BB>
</AA>
<AA Aattr="xyz2">
<BB bAttr1="firefox" bAttr2="aaa" >
</BB>
<BB bAttr1="chrome" bAttr2="ccc" >
</BB>
<BB bAttr1="firefox" bAttr2="ddd" >
</BB>
</AA>
属性「Aattr」がxyz1であるノード「AA」から、ノード「BB」の属性「bAttr2」の個別の\一意の値を選択したい
与えられたxmlについて、「aaa」、「bbb」として出力する必要があると言います
キーを使用して次のロジックを試しました。しかし、うまくいきませんでした。助けてください
<xsl:key name="nameDistinct" match="BB" use="@bAttr1"/>
<xsl:template match="/">
<xsl:for-each select="ROOT/AA[@Aattr='xyz1']">
<xsl:for-each select="BB[generate-id()=generate-id(key('nameDistinct',@bAttr2)[1])]">
<xsl:value-of select="@bAttr2"/>
</xsl:for-each>
</xsl:for-each>
</xsl:template>