Calculate the total for the remaining items. If this is the last item (the parameter $index is equal to the number of <item> elements), then the total for the remaining items is zero. Otherwise, the total for the remaining items is returned by calling the template again.
When we call the template again, we increment the position of the current item:
<xsl:with-param name="index" select="$index+1"/>
We also update the parameter $runningTotal, which is equal to the value of the current item plus the previous value of $runningTotal:
<xsl:with-param name="runningTotal"
select="$runningTotal+$currentItem"/>