XSLT summarize value

前端 未结 1 956
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-21 11:27

I need to generate an item that accumulates a total for a given XML input.

The XML input is:



        
相关标签:
1条回答
  • 2021-01-21 12:06

    Use the sum() function to total the @amount values:

    <xsl:value-of select="sum(/catalog/item/@amount)"/>
    

    Note that you'll want to move your Total: label along with the above xsl:value-of outside of your xsl:for-each loop.

    0 讨论(0)
提交回复
热议问题