[xsl] Losing xsl:param values within a called template for-each loop

Subject: [xsl] Losing xsl:param values within a called template for-each loop
From: "CROFT, MICHAEL" <MCROFT@xxxxxxxxx>
Date: Mon, 13 May 2002 17:51:36 -0400
I have a code excerpt below where Im trying to get a value from a dynamic
expression, and pass this value to a named template.  Within this template,
I want to cycle through all the specified <KeyGroup> elements and if its
attribute value (@id)  equals a the value I passed as a xsl:param, set the
text of its child element to the key value... I have the correct values when
I first enter the named template, then when I start to loop, I lose the parm

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-"
sourceLogicalId="ANO" state="exists"/>
			<AlternateId value="826620515239830"
sourceLogicalId="I3" state="exists"/> <!-- pass the @value to the named
		<KeyGroup id="K2" keyGroupType="PARTY">
			<AlternateId value="2001-07-25-"
sourceLogicalId="ANO" state="exists"/>
			<AlternateId value="953689412580434"
sourceLogicalId="I3" state="exists"/>
		<AddPelpPolicyRequest cmdType="request"
				<KeyGroup refid="K1"/> <!-- need to match
this refid value to the id value of the CrfActionGroup KeyGroup element seen
				<partyId/> <!-- this needs to become the
value of the @value for the <AlternateID> element where its @sourceLogicalID
= I3 as seen above-->
					<KeyGroup refid="K1"/>
					<partyId>PARTY ID</partyId>
					<KeyGroup refid="K2"/>

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"
					<xsl:with-param name="keyid"

	<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-->
					<xsl:if test="@refid = '$keyid'">
<!-- if the refId = parm passed in, then output the other parm value passed
						partyId <xsl:value-of

Also, Im not sure how to avoid using the name & match attributes in the same
xsl:template element, and still cycle through the specific <KeyGroup>
elements for the parent <COMMAND> element?  Any help is greatly appreciated.

Michael D. Croft
Corporate Information Systems
Software Development Team

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the sender and postmaster@xxxxxxxxxx

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread