所以,我有一個整數數組。我想總結一下。但不是整個數組,而是直到由另一個變量指定的數組中的位置。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