I have XSLT 1.0 code like this:
<xsl:key name="enemyItems"
match="metadata[attributes/metadata_key/@value = 'enemylist']"
use="attributes/metadata_refkey/@value"/>
<xsl:template match="item">
<xsl:variable name="enemyList"
select="key('enemyItems', @key)/attributes/@value"/>
<xsl:if test="string-length($enemyList) > 0">
<xsl:value-of select="@name"/>
</xsl:if>
</xsl:template>
As I understand it, a key can store more than one value for a particular element. I believe the code above is only getting the first value when referring to key('enemyItems', @key)
.
So, I want to wrap that code in an xsl:for-each, like this
<xsl:template match="item">
<xsl:for-each select="key('enemyItems', @key)">
<xsl:variable name="enemyList"
select="???/attributes/@value"/>
<xsl:if test="string-length($enemyList) > 0">
<xsl:value-of select="@name"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
My question is: What goes in the ??? part? (That is, what is the name of the iteration variable or thing?)