如何总结XSL中for-each循环的结果?

问题描述

| 我是XSL的新手,所以我真的不知道该怎么做。我有一个for-each语句,它对\“ cell \”类型的每个元素进行一些计算。如何汇总结果并将其存储在变量中以便显示?我已经包含了部分代码。 我希望有人知道该问题的解决方案。感谢您的时间和精力!
<?xml version=\"1.0\"?>
<xsl:stylesheet version=\"1.0\">

<xsl:output media-type=\"xml\" encoding=\"ISO-8859-1\" indent=\"yes\"/>

<xsl:key name=\"object-map\" match=\"/Data/Objects/*\" use=\"@ExternalId\"/>
<xsl:template match=\"/\">
 <Data>
  <Objects>
    ...
    ...
    ...

    <xsl:for-each select=\"Data/Objects/Cell\">
   <xsl:attribute name=\"PpXmlVer\">
     <xsl:text>7.0</xsl:text>
   </xsl:attribute>

      ......................

      <!--Calculating Machine Time: -->
      <Cell>
        <xsl:attribute name=\"ExternalId\">
          <xsl:value-of select=\"@ExternalId\"/>
        </xsl:attribute>
        <!-- calculated.-->
        <FlipMachineTime>
          <xsl:choose>
            <xsl:when test=\"./FlipPlanedOccupationTime &gt; 0\">
              <xsl:value-of select=\"here is a complicated formula to compute\"/>
            </xsl:when>
            <xsl:otherwise>0</xsl:otherwise>
          </xsl:choose>
        </FlipMaschineTime>
      </Cell>

      </xsl:for-each>

      Here I would like to have the sum of FlipMachineTime 
      for all encountered elements of type cell.

    ...........

  </Objects>
 </Data>
    

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)