你误用了
/
符号。试试这个方法:
XSLT 1
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:iws="http://vsystems.com/WS/StockAdjustments"
exclude-result-prefixes="iws">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:key name="k1" match="iws:StockAdjustment" use="concat(@Article, '|', @Status)"/>
<xsl:template match="/iws:StockAdjustments">
<xsl:copy>
<xsl:for-each select="iws:StockAdjustment[generate-id()=generate-id(key('k1', concat(@Article,'|',@Status))[1])]">
<xsl:copy>
<xsl:copy-of select="@Article"/>
<QTY_EXPE>
<xsl:value-of select="sum(key('k1', concat(@Article,'|',@Status))/@Quantity)" />
</QTY_EXPE>
</xsl:copy>
</xsl:for-each>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
结果不是你发的,而是我跟你一起去了。不管怎样,总数是正确的。