我有一个父变量和两个子变量用于累积
我想使用这两个子变量来选择两个不同的值
我只能对其进行硬编码以使其像所有其他教程一样工作,例如:$parent[1]/Price 和 $parent[1]/Quantity
但相反,我想要以下内容:
$parent[1]/$child1 where $parent[1] = orders[1]/order and $child1 = price
$parent[1]/$child2 where $parent[1] = orders[1]/order and $child2 = quantity
<xsl:call-template name="total">
<xsl:with-param name="pList" select="$parent"/>
<xsl:with-param name="price" select="Price"/>
<xsl:with-param name="quantity" select="Quantity"/>
</xsl:call-template>
<xsl:template name="total">
<xsl:param name="pListItem"/>
<xsl:param name="pAccum" select="0"/>
<xsl:param name="price"/>
<xsl:param name="quantity"/>
<xsl:choose>
<xsl:when test="$pListItem">
<xsl:call-template name="total">
<xsl:with-param name="pListItem" select="$pListItem[position() > 1]"/>
<xsl:with-param name="pAccum"
select="$pAccum + $vHead/$price * $vHead/$quantity"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$pAccum"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>