我正在尝试计算某些节点的 SUM。学习者将有 1 个或多个学习目标,我需要知道学习者的学习目标的 GLH 节点总数。
这是一些示例 XML。
<Learner>
<LearnRefNumber>422</LearnRefNumber>
<FamilyName>John</FamilyName>
<GivenNames>Smith</GivenNames>
<LearningDelivery>
<LearnAimRef>zilsk14a</LearnAimRef>
<AimType>4</AimType>
<AimSeqNumber>1</AimSeqNumber>
<GLH>2775</GLH>
</LearningDelivery>
<LearningDelivery>
<LearnAimRef>zilsk14b</LearnAimRef>
<AimType>4</AimType>
<AimSeqNumber>2</AimSeqNumber>
<GLH>2500</GLH>
</LearningDelivery>
</Learner>
这是我的 XSL。学习目标的计数工作正常,但我正在努力总结 GLH。
<xsl:for-each select="t:Learner">
<div class="learner">
<xsl:variable name="LearningAims" select="count(t:LearningDelivery)" />
<xsl:variable name="LearnerGLH" select="sum(t:LearningDelivery/GLH)" />
<table>
<tr>
<th>Learner Ref</th>
<th>Learning Aims</th>
<th>Total GLH</th>
</tr>
<tr>
<td>
<xsl:value-of select="t:LearnRefNumber" />
</td>
<td>
<xsl:value-of select="$LearningAims" />
</td>
<td>
<xsl:value-of select="$LearnerGLH" />
</td>
</tr>
</table>
</div>
请帮忙。非常感谢