【发布时间】:2020-06-26 19:46:57
【问题描述】:
我正在全局声明一个变量,并希望在带有 IF 条件的 for 循环中递增。然后稍后想在最后的 XSLT 的 Trailer 记录中使用该变量。
<xsl:for-each>
<xsl:if test="../xyz">
<WorkerBen>
<I need to increment a variable BENCountV here once above condition is met>
</WorkerBEN>
</xsl:if>
</xsl:for-each>
【问题讨论】:
-
请发布minimal reproducible example 显示输入和预期输出。
-
在 xslt 中,不需要 for 循环来实现:您只需将变量设置为
<xsl:variable name="BENCountV" select="count(yourXpath[yourCondition])"/>