为每个多条件循环添加 Count 并返回总记录 XSLT

Adding Count For each multiple conditions loop and returning total records XSLT

<xsl:variable name="z">0</xsl:variable>
<xsl:variable name="x">0</xsl:variable>
  <xsl:for-each select="wd:Report_Entry">
    <xsl:choose>
      <xsl:when test="count(wd:Supplier_Invoice_Line_group)>1">
        <xsl:for-each select="wd:Supplier_Invoice_Line_group">
          <xsl:value-of select="$z =$z+1 "/>
         </xsl:for-each>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$x =$x+1 "/>
        </xsl:otherwise>
    </xsl:choose>
    </xsl:for-each>
<xsl:value-of select="$x+$z"/>

对于上述情况,我没有得到任何结果。我正在尝试为 2 个不同的循环声明 2 个变量。然后添加这些记录以获得总计数。如果有人能指导我,我将不胜感激。

看来你有 <xsl:value-of select="$x+$z"/> 的地方你可以使用 <xsl:value-of select="sum((wd:Report_Entry/count(wd:Supplier_Invoice_Line_group), count(wd:Report_Entry[not(wd:Supplier_Invoice_Line_group)])))"/>。假定 XSLT 2 或更高版本。