这是我的 xml:
<?xml version = "1.0" encoding = "ISO-8859-1"?>
<List>
<Customer>
<client name="Jean Charles" />
<transaction amount="500" />
<question> What is the latest brand </question>
<transaction amount="1200" />
</Customer>
<Customer>
<client name="Philippe" />
<transaction amount="600" />
<transaction amount="800" />
<question> Where can I find the 2002 model </question>
<transaction amount="2000" />
</Customer>
</List>
和 XSLT:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Customer transaction</h2>
<table border="1">
<xsl:for-each select="List/Customer">
<tr>
<td><xsl:value-of select="client/@name"/></td>
<xsl:for-each select="transaction">
<td><xsl:value-of select="@amount"/></td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
但我需要每个客户交易总额的输出。例如第一个客户 500+1200 = 1700。
任何人都可以帮助解决这个问题。