xml template and param



I have following xsl



<xsl:variable name="ComparableNo" select="position()"></xsl:variable>
<xsl:for-each select="typ:AICPackage">
<xsl:variable name="PackageCode" select="typ2:Code"/>
<xsl:if test="number(typ:AdjustmentAmount) != 0">
<tr class="listTblData_row2">
<td class="sectDataField_value" style="padding-left:10px;">
<xsl:value-of select="typ:Description"/>
</td>
<td class="sectDataField_value" style="text-align:center">
<xsl:choose>
<xsl:when test="typ:TLVStatus/typ:Existatus = 'Package' ">
<xsl:value-of select="typ:TLVStatus/typ:PartOfPkgName"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="typ:TLVStatus/typ:Existatus"/>
</xsl:otherwise>
</xsl:choose>
</td>
<td class="sectDataField_value" style="text-align:center">
<xsl:choose>
<xsl:when test="typ:CVStatus/typ:Existatus = 'Package' ">
<xsl:value-of select="typ:CVStatus/typ:PartOfPkgName"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="typ:CVStatus/typ:Existatus"/>
</xsl:otherwise>
</xsl:choose>
</td>
<td class="sectDataField_value" style="text-align:right">
<xsl:call-template name="FormatDollarAmt">
<xsl:with-param name="Value" select="typ:AdjustmentAmount"/>
</xsl:call-template>
</td>
</tr>
</xsl:if>

<!--Package contailed details start-->
<xsl:for-each select="typ:ContainedOption">
<!-- Inner loop to check contained options start-->
<xsl:call-template name="AICOptionDetails">
<xsl:with-param name="EquipmentCode" select="typ:Code"></xsl:with-param>
<xsl:with-param name="ComparableNo" select="$ComparableNo"></xsl:with-param>
<xsl:with-param name="PackageCode" select="$PackageCode"></xsl:with-param>
<xsl:with-param name="ComparableType" select="$ComparableType"></xsl:with-param>
</xsl:call-template>
<!-- Inner loop to check contained options end-->
</xsl:for-each>
<!--Package contailed details end-->
</xsl:for-each>


Following is the template :



<xsl:template name="AICOptionDetails">
<xsl:param name="EquipmentCode"></xsl:param>
<xsl:param name="ComparableNo"></xsl:param>
<xsl:param name="PackageCode"></xsl:param>
<xsl:param name="ComparableType"></xsl:param>
<xsl:for-each select="//typ2:MarketSurveyAssignmentDTO/typ2:ComparableVehicles/*[local-name()=$ComparableType][$ComparableNo]/typ:AICOption">
<xsl:choose>
<xsl:when test="typ:Code =$EquipmentCode and (not(typ:DisableForPackageFlag) and not(typ:DisableForDoubleDipFlag)) and ($PackageCode = typ:TLVStatus/typ:PartOfPkgCode)">
<xsl:if test="number(typ:AdjustmentAmount) != 0">
<tr class="listTblData_row2">
<td style="padding-left:20px;" class="sectDataField_value">
<xsl:value-of select="typ:Description"/>
</td>
<td class="sectDataField_value" style="text-align:center">
<xsl:choose>
<xsl:when test="typ:TLVStatus/typ:Existatus = 'Package' ">
<xsl:value-of select="typ:TLVStatus/typ:PartOfPkgName"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="typ:TLVStatus/typ:Existatus"/>
</xsl:otherwise>
</xsl:choose>
</td>
<td class="sectDataField_value" style="text-align:center">
<xsl:choose>
<xsl:when test="typ:CVStatus/typ:Existatus = 'Package' ">
<xsl:value-of select="typ:CVStatus/typ:PartOfPkgName"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="typ:CVStatus/typ:Existatus"/>
</xsl:otherwise>
</xsl:choose>
</td>
<td class="sectDataField_value" style="text-align:right">
<xsl:call-template name="FormatDollarAmt">
<xsl:with-param name="Value" select="typ:AdjustmentAmount"/>
</xsl:call-template>
</td>
</tr>
</xsl:if>
</xsl:when>

<xsl:when test="typ:Code =$EquipmentCode and (not(typ:DisableForPackageFlag) and not(typ:DisableForDoubleDipFlag)) and ($PackageCode = typ:CVStatus/typ:PartOfPkgCode)">
<xsl:if test="number(typ:AdjustmentAmount) != 0">
<tr class="listTblData_row2">
<td style="padding-left:20px;" class="sectDataField_value">
<xsl:value-of select="typ:Description"/>
</td>
<td class="sectDataField_value" style="text-align:center">
<xsl:choose>
<xsl:when test="typ:TLVStatus/typ:Existatus = 'Package' ">
<xsl:value-of select="typ:TLVStatus/typ:PartOfPkgName"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="typ:TLVStatus/typ:Existatus"/>
</xsl:otherwise>
</xsl:choose>
</td>
<td class="sectDataField_value" style="text-align:center">
<xsl:choose>
<xsl:when test="typ:CVStatus/typ:Existatus = 'Package' ">
<xsl:value-of select="typ:CVStatus/typ:PartOfPkgName"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="typ:CVStatus/typ:Existatus"/>
</xsl:otherwise>
</xsl:choose>
</td>
<td class="sectDataField_value" style="text-align:right">
<xsl:call-template name="FormatDollarAmt">
<xsl:with-param name="Value" select="typ:AdjustmentAmount"/>
</xsl:call-template>
</td>
</tr>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>


With this AICOptionDetails is not getting displayed but if I remove following condition



($PackageCode = typ:TLVStatus/typ:PartOfPkgCode)


then those options are getting displayed, I am not able to find reason why that condition is failing. Please help me I am new to XSLT


Following is XML data for AICOption



<typ:AICOption>
<typ:Code>CF5</typ:Code>
<typ:Description>SUNROOF, POWER, TILT-SLIDING, ELECTRIC</typ:Description>
<typ:PINOptionID>14220</typ:PINOptionID>
<typ:PINOptionDescription>SUNROOF, POWER, TILT-SLIDING, ELECTRIC</typ:PINOptionDescription>
<typ:AdjustmentPct>0.035672</typ:AdjustmentPct>
<typ:ConfidenceFactor>0.015199</typ:ConfidenceFactor>
<typ:AdjustmentAmount>-356.29</typ:AdjustmentAmount>
<typ:TLVStatus>
<typ:Existatus>Package</typ:Existatus>
<typ:PartOfPkgCode>PDB</typ:PartOfPkgCode>
<typ:PartOfPkgName>CALIFORNIA CTS LUXURY PACKAGE</typ:PartOfPkgName>
</typ:TLVStatus>
<typ:CVStatus>
<typ:Existatus>Yes</typ:Existatus>
</typ:CVStatus>
</typ:AICOption>

No comments:

Post a Comment