下面是我输入的 XML:
<?xml version="1.0" encoding="utf-8" ?>
<LogiusInhouse>
<qty9 field="QTY_9,11#">
<type>90</type>
<value>12</value>
</qty9>
<qty9 field="QTY_9,11#">
<type>90</type>
<value>12</value>
</qty9>
<dtm9 field="DTM_9,11#">
<type>145</type>
<date>20130308</date>
<format>102</format>
</dtm9>
</LogiusInhouse>
XSL:
<xsl:template match="/LogiusInhouse">
<xsl:value-of select="abs(sum(qty9[type='90']/value))div 1000 "/>
</xsl:template>
我的问题是我需要得到绝对总和,然后它必须除以 1000 但我没有得到结果。请帮我解决这个问题。
最佳答案
或者,您可以只使用这个:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" indent="yes"/>
<xsl:template match="/LogiusInhouse">
<xsl:value-of select="sum(qty9/value)" />
</xsl:template>
</xsl:stylesheet>
关于xslt - XSL 中的求和函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21822741/