所以,我有一个整数数组。我想总结一下。但不是整个数组,而是直到由另一个变量指定的数组中的位置。xslt:总结一个整数数组
例如。此beeing我的数组:
<xsl:variable name="myArray" as="xs:int*">
<Item>11</Item>
<Item>22</Item>
<Item>33</Item>
<Item>44</Item>
<Item>55</Item>
<Item>66</Item>
<Item>77</Item>
<Item>88</Item>
</xsl:variable>
这beeing我的位置可变:
<xsl:variable name="myPosition" as="xs:int*">3</xsl:variable>
我期望结果66. (因为:$ myArray的[1] + $ myArray的[2] + $ myArray的[3] = 11 + 22 + 33 = 66)
听起来很简单,但我找不到解决方案。
我想我需要“总和”功能和“for”和“return”表达式。但我必须承认,并不了解我发现的这些例子和说明。
是的,我使用XSLT 2.0对不起,不包含此信息!效果很好! – cis