I have a series of param elements inside a template that rely upon each other (i.e. each subsequent param uses the value of the previous one as part of it's XPath)
e.g.
<xsl:param name="input1" select="path/node/@value"/>
<xsl:param name="input2" select="path/anothernode[@value=$input1]/anothervalue"/>
<xsl:param name="input3" select="path/thirdnode[@value=$input2]/@endvalue"/>
etc. etc.
The stack of params works perfectly on a single run through. However, when I use a for-each loop to call the template and pass the for-each value to it using xsl:with-param, only the top param is processed - the value is NOT passed to the next the parameter.
Here's my full xsl:
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/" name="test">
<xsl:param name="memberId"
select="PLMXML/Organisation/UserData/UserValue/UserList/Item/@value"/>
<xsl:param name="memberRef"
select="PLMXML/OrganisationMember[@id=$memberId]/@memberRef"/>
<xsl:param name="memberRef2"
select="translate($memberRef,'#','')"/>
<xsl:param name="userId"
select="PLMXML/User[@id=$memberRef2]/@personRef"/>
<xsl:param name="userId2"
select="translate($userId,'#','')"/>
<xsl:param name="personName"
select="PLMXML/Person[@id=$userId2]/@lastName"/>
<xsl:param name="groupRef"
select="PLMXML/User[@id=$memberRef2]/UserData/UserValue/@dataRef"/>
<xsl:param name="groupRef2"
select="translate($groupRef,'#','')"/>
<xsl:param name="groupName"
select="PLMXML/Organisation[@id=$groupRef2]/@name"/>
<xsl:param name="roleRef"
select="PLMXML/Organisation[@id=$groupRef2]/UserData/UserValue/@dataRef"/>
<xsl:param name="roleRef2"
select="translate($roleRef,'#','')"/>
<xsl:param name="roleName"
select="PLMXML/Role[@id=$roleRef2]/@name"/>
<xsl:value-of select="$memberId"/>
<xsl:value-of select="$memberRef"/>
<xsl:value-of select="$personName"/>
<xsl:value-of select="$groupName"/>
<xsl:value-of select="$roleName"/>
</xsl:template>
<xsl:template match="/">
<xsl:for-each select="PLMXML/Organisation/UserData/UserValue/UserList/Item/@value">
<xsl:call-template name="test">
<xsl:with-param name="memberId" select="."/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
However, the for-each loop only populates the top variable of the stack in template 'test' - i.e. xsl:value-of select="$memberId"/>
works but <xsl:value-of select="$memberRef"/>
does not.
Any ideas on how to work around this issue would be much appreciated.