我想要得到的总和。这是xslt代码。如何获得属性中的值的总和在xslt
<xsl:template match="Entry">
<xsl:if test="position() <= 10">
<tr>
<td>
<xsl:value-of select="substring-before(@Value,'||')"/>
</td>
<td>
<xsl:value-of select="format-number(substring(substring-after(@Value,'||||'),1,10),'#.#')"/>
</td>
</tr>
</xsl:if>
</xsl:template>
上面的代码会将数据填充为两个颜色。没关系。现在我需要得到的总和<xsl:value-of select="format-number(substring(substring-after(@Value,'||||'),1,10),'#.#')"/>
我来自程序编程。我读了很多文章,但我仍然想知道如何得到这个总和。有谁能够帮助我?
这里是XML
<TopHoldings Currency="xxx">
<Entry Type="CName||C||S||Fund Weight (%)||Benchmark weight (%)" Value="Ab||U||||1.2170000000000||" Date="8/31/2011" />
这里是整个XSLT
<table style="width:50%;font-size:12px;" cellspacing="0" cellpadding="0">
<tr style="width:50%; text-align:left;background-color:E6F1F9;">
<th> </th>
<th> % of funds </th>
</tr>
<xsl:apply-templates select="$items">
<xsl:sort select="format-number(substring(substring-after(@Value,'||||'),1,10),'#.#')" order="descending"/>
<xsl:sort select="substring-before(@Value,'||')"/>
</xsl:apply-templates>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="Entry">
<xsl:if test="position() <= 10">
<tr>
<td>
<xsl:value-of select="substring-before(@Value,'||')"/>
</td>
<td>
<xsl:value-of select="format-number(substring(substring-after(@Value,'||||'),1,10),'#.#')"/>
</td>
</tr>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
您能否向我们展示您引用此模板的模板?您是否只想总结前10个值? – JLRishe
是的我想获得十个值的总和 – newday
并且关于我对更大的XSLT样本...?您使用什么处理器来执行您的XSLT? – JLRishe