Hi,

I'm quite new to xslt and I'm trying to understand the inner for-loop in the code below. I think
it loops over all <ClassifiedProductDefinition> elements with a <SpeciesGroupKey> that matches the
the one in <SpeciesGroupDefinition> and where none of the preceding <ClassifiedProductDefinition>
elements have the same <SpeciesGroupKey> and <ProductGroupName> as the current <ClassifiedProductDefinition>
element. Is this correct or am I missing something here?

Code:
<xsl:variable name="productGroups">
   <xsl:for-each select="hpr:SpeciesGroupDefinition">
     <xsl:variable name="species" select="hpr:SpeciesGroupKey"/>
	<xsl:for-each select="../hpr:ProductDefinition/hpr:ClassifiedProductDefinition[hpr:SpeciesGroupKey = $species and not(./hpr:ProductGroupName = preceding::[hpr:SpeciesGroupKey = $species]/hpr:ProductGroupName)]">
	  <Product>
	    <xsl:copy-of select="hpr:SpeciesGroupKey"/>
	    <xsl:copy-of select="hpr:ProductGroupName"/>
	  </Product>
       </xsl:for-each>
    </xsl:for-each>
</xsl:variable>