| Subject: Re: [xsl] Losing xsl:param values within a called template  for-each loop From: Greg Faron <gfaron@xxxxxxxxxxxxxxxxxx> Date: Mon, 13 May 2002 16:22:27 -0600 | 
Here is the sample xml doc...
<CrfActionGroup destinationLogicalId="I3">
                <CommandReference refid="CMD1"/>
                <KeyGroup id="K1" keyGroupType="PARTY"> <!-- get the
keygroup where its AlternateId child has a @sourceLogicalID equal to I3-->
                        <AlternateId value="2001-07-25-00.00.00.003170"
sourceLogicalId="ANO" state="exists"/>
                        <AlternateId value="826620515239830"
sourceLogicalId="I3" state="exists"/> <!-- pass the @value to the named
template-->
                        <UUID>1155</UUID>
                </KeyGroup>
                <KeyGroup id="K2" keyGroupType="PARTY">
                        <AlternateId value="2001-07-25-00.00.00.003171"
sourceLogicalId="ANO" state="exists"/>
                        <AlternateId value="953689412580434"
sourceLogicalId="I3" state="exists"/>
                        <UUID>1154</UUID>
                </KeyGroup>
        </CrfActionGroup>
        <COMMAND>
                <AddPelpPolicyRequest cmdType="request"
cmdMode="alwaysRespond">
                        <Individual>
                                <KeyGroup refid="K1"/> <!-- need to match
this refid value to the id value of the CrfActionGroup KeyGroup element seen
above-->
                                <partyId/> <!-- this needs to become the
value of the @value for the <AlternateID> element where its @sourceLogicalID
= I3 as seen above-->
                        </Individual>
                        <LineOfBusiness>
                                <PartyRole>
                                        <KeyGroup refid="K1"/>
                                        <partyId>PARTY ID</partyId>
                                </PartyRole>
                                <PartyRole>
                                        <KeyGroup refid="K2"/>
                                        <partyId/>
                                </PartyRole>
                        </LineOfBusiness>
                </AddPelpPolicyRequest>
        </COMMAND>
Here is the xsl template....
<xsl:template match="KeyGroup"> <!-- search through first set of KeyGroup elements -->
<xsl:for-each select="AlternateId"> <xsl:if test=" @sourceLogicalId = 'I3' "> <!-- get its child with the attribute value specified--> <xsl:call-template name="command"> <!-- if the test is true, call the named template passing the parms--> <xsl:with-param name="keyvalue" select="@value"/> <xsl:with-param name="keyid" select="../@id"/> </xsl:call-template> </xsl:if> </xsl:for-each> </xsl:template>
<xsl:template name="command" match="COMMAND">
                <xsl:param name="keyvalue"/>
                <xsl:param name="keyid"/>
                        <xsl:if test="($keyvalue != '') and ($keyid != '')">
                        <!-- TEST VALUES These output correctly here-->
                        <xsl:value-of select="$keyvalue"></xsl:value-of>
                        <xsl:value-of select="$keyid"></xsl:value-of>
                                <xsl:for-each select="descendant::KeyGroup">
<!--search the KeyGroup descendants of the COMMAND element-->
                                        <!-- LOSING THE PARAM VALUES HERE-->
                                        <xsl:if test="@refid = '$keyid'">
<!-- if the refId = parm passed in, then output the other parm value passed
in-->
                                                partyId <xsl:value-of
select="$keyvalue"/>
                                        </xsl:if>
                                </xsl:for-each>
                        </xsl:if>
        </xsl:template>
Greg Faron Integre Technical Publishing Co.
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| [xsl] Losing xsl:param values withi, CROFT, MICHAEL | Thread | Re: [xsl] Losing xsl:param values w, J.Pietschmann | 
| [xsl] IE Error Message, Joel Konkle-Parker | Date | Re: [xsl] IE Error Message, Greg Faron | 
| Month |