XSLT中如何计算测试结果通过率

How to calculate the test results pass percentage in XSLT

输入是一个 XML 文件

<test-results name="project name" total="73" errors="0" failures="43" not-run="0" inconclusive="0" ignored="0" skipped="0" invalid="0" date="2016-01-05" time="20:32:22">
.......
</test-results>

我想计算 "No of pass results" 和 "Pass Percentage"。我已经完成了 No of pass 结果。工作正常

               <tr>
                <td>Number of Passes</td>
                <td>
                  <xsl:variable name="failures" select="@failures"/>
                  <xsl:variable name="total" select="@total"/>
                  <xsl:choose>
                    <xsl:when test="$failures != ''">
                      <xsl:value-of select="($total - $failures)"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="@total"/>
                    </xsl:otherwise>
                  </xsl:choose>
                </td>
              </tr>

现在我想计算通过率(例如:- 87.45%)。我尝试了以下逻辑。但它抛出异常

<tr>
        <td>Success Rate</td>
        <td>
          <xsl:variable name="Pass" select="@total - @failures"/>
          <xsl:variable name="totalNo" select="@total"/>
          <xsl:value-of select="($Pass/$totalNo)*100"/>
        </td>
      </tr>

谁能帮我计算一下通过率? 提前致谢。

使用 div 运算符代替 / 符号:

<xsl:value-of select="$Pass div $totalNo * 100"/>