I’m having trouble passing a parameter to a template.
<!-- // Product / Instances -->
<xsl:template match="/data/products/instances">
<ul>
<xsl:apply-templates select="item">
<xsl:with-param name="idp" select="@id"/>
</xsl:apply-templates>
</ul>
</xsl:template>
<!-- // Product / Instances / Instance -->
<xsl:template match="/data/products/instances/item">
<xsl:param name="idp"/>
<p>$idp: <xsl:value-of select="$idp"/></p> <!-- $idp is empty -->
<xsl:for-each select="/data/instances/entry">
<xsl:if test="@id = $idp">
<p><xsl:value-of select="code"/></p>
</xsl:if>
</xsl:for-each>
</xsl:template>
/data/products/instances/item has an attribute named id, which has a value of an integer.
Although the second template and its for-each loop are being processed (I’ve tested them by outputting dummy output from within them), the value of the $idp parameter is not being passed to the second template.
Thanks.
You would need to show enough details to allow us to reproduce the issue, otherwise it is hard to tell what goes wrong.
I think you don’t need any parameter, and you should use a key