Can I filter a Template Match by a global Param?
This First Code block Works:, but the seconds does not and the Only Difference between the two is the first has the filter hard-coded the second tries to use the param value.
But this code does not work:
This First Code block Works:, but the seconds does not and the Only Difference between the two is the first has the filter hard-coded the second tries to use the param value.
Code:
<xsl:stylesheet version="2.0" xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform">[/URL]
[highlight]
<xsl:param name="Param_ParticipantIsManaged" select="'1'"/>
[/highlight]
<xsl:variable name="v_ParticipantIsManaged">
<xsl:value-of select="$Param_ParticipantIsManaged"/>
</xsl:variable>
<xsl:output method="xml"/>
<!-- ROOT -->
<xsl:template match="/">
<TEST v="{$Param_ParticipantIsManaged}"/>
<xsl:apply-templates select="/ExchangeRtParticipants/AgreementParticipant"/>
</xsl:template>
[highlight]
<xsl:template match="AgreementParticipant[@ParticipantIsManaged='1']">[/highlight]
<ExchangeRtParticipants test="{$v_ParticipantIsManaged}">
<AgreementParticipant Identifier="{@Identifier}" ReinscReferenceNicknameTxt="{@ReinscReferenceNicknameTxt}"
SourceCurrencyTypeCode="{@SourceCurrencyTypeCode}" ReinscReferenceNameTxt="{@ReinscReferenceNameTxt}"
ReinscTypeDsc="{@ReinscTypeDsc}" SourceCurrencyTypeId="{@SourceCurrencyTypeId}"
TargetCurrencyTypeCode="{@TargetCurrencyTypeCode}" TargetCurrencyTypeId="{@TargetCurrencyTypeId}"
BeginDt ="{@BeginDt}" Rate="{@Rate}" RateSource="{@RateSource}"
ParticipantIsManaged="{@ParticipantIsManaged}"
/>
</ExchangeRtParticipants>
</xsl:template>
</xsl:stylesheet>
But this code does not work:
Code:
<xsl:stylesheet version="2.0" xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform">[/URL]
<xsl:param name="Param_ParticipantIsManaged" select="'1'"/>
<xsl:variable name="v_ParticipantIsManaged">
<xsl:value-of select="$Param_ParticipantIsManaged"/>
</xsl:variable>
<xsl:output method="xml"/>
<!-- ROOT -->
<xsl:template match="/">
<TEST v="{$Param_ParticipantIsManaged}"/>
<xsl:apply-templates select="/ExchangeRtParticipants/AgreementParticipant"/>
</xsl:template>
[highlight]
<xsl:template match="AgreementParticipant[@ParticipantIsManaged='{$Param_ParticipantIsManaged}']">[/highlight]
<ExchangeRtParticipants test="{$v_ParticipantIsManaged}">
<AgreementParticipant Identifier="{@Identifier}" ReinscReferenceNicknameTxt="{@ReinscReferenceNicknameTxt}"
SourceCurrencyTypeCode="{@SourceCurrencyTypeCode}" ReinscReferenceNameTxt="{@ReinscReferenceNameTxt}"
ReinscTypeDsc="{@ReinscTypeDsc}" SourceCurrencyTypeId="{@SourceCurrencyTypeId}"
TargetCurrencyTypeCode="{@TargetCurrencyTypeCode}" TargetCurrencyTypeId="{@TargetCurrencyTypeId}"
BeginDt ="{@BeginDt}" Rate="{@Rate}" RateSource="{@RateSource}"
ParticipantIsManaged="{@ParticipantIsManaged}"
/>
</ExchangeRtParticipants>
</xsl:template>