Problem while using position() in for-loop
When i try to use position() inside the for-loop, i get only one record.It should display nine records.I tried removing the position() code and it displays 9 records.
<xsl:for-each select="$distinctPrepackIndicatorUpcCode">
<xsl:call-template name="printPrepackBox">
<xsl:with-param name="prepackItem" select="VariableDataSet/VariableDataElement[@Code='750']/@Value" />
<xsl:with-param name="prePackUpc" select="VariableDataSet/VariableDataElement[@Code='790']/@Value" />
<xsl:with-param name="totalPacks" select="./@Case1Count" />
</xsl:call-template>
<table width="94%" cellpadding="0" cellspacing="0" class="prepack_line_item_table" border = "1">
<xsl:call-template name="printPrepackLineItemHeader"/>
<xsl:choose>
<xsl:when test="$prepackItemIndex <= count(key('prepackIndicatorUpcCodeKey', concat(VariableDataSet/VariableDataElement[@Code = '750']/@Value, '-', VariableDataSet/VariableDataElement[@Code = '790']/@Value)))">
<xsl:for-each select="key('prepackIndicatorUpcCodeKey', concat(VariableDataSet/VariableDataElement[@Code = '750']/@Value, '-', VariableDataSet/VariableDataElement[@Code = '790']/@Value))">
<xsl:if test="position() = $prepackItemIndex">
<xsl:call-template name="printPrepackLineItemRow">
<xsl:with-param name="itemNo" select="./@Style" />
<xsl:with-param name="itemColor" select="./@Color" />
<xsl:with-param name="itemSize" select="./@Size" />
<xsl:with-param name="itemUpc" select="./@UPC" />
<xsl:with-param name="itemMsrp" select="VariableDataSet/VariableDataElement[@Code='620']/@Value" />
<xsl:with-param name="qtyPerPack" select="./@Case1ItemQuantity" />
<xsl:with-param name="totalUnits" select="./@Case1Count * ./@Case1ItemQuantity" />
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</table>
</xsl:for-each>
|