2012-10-19 3 views
-1

일부 xml 코드를 작성한 다음 합산합니다.exsl : node-set의 합계가 잘못된 값을 반환합니다.

   <xsl:variable name ="tmpTotal"> 
       <root> 
        <xsl:for-each select="key('idxid',$id)//parent::*/transaction/transaction-date[substring(@iso-date,1,4) = $newyear ]"> 
         <xsl:if test="../transaction-type[@code='E']"> 
         <item> 
          <xsl:value-of select="number(../value)"/> 
         </item> 
         </xsl:if> 

        </xsl:for-each> 
       </root> 
      </xsl:variable> 

       <xsl:variable name="value" select="sum(exsl:node-set($tmpTotal)/root/item)" /> 
       <h3> 
       All: <xsl:value-of select="exsl:node-set($tmpTotal)/*"/> <br/> 
       Year: <xsl:value-of select="$newyear"/> <br/> 
       Value:<xsl:value-of select="$value"/> <br/> 

       </h3> 

결과는 다음과 같다 : 모든 : 96363464029561 년도 : 2005 값 : 73837이

(모든 사람 : 출력) 번호의 목록과 같다 다음과 : 여기에 코드입니다 합계는 42657이어야합니다. 그러나 합계 (exsl : node-set ($ tmpTotal)/root/item)의 합계는 73837입니다. XML에서 숫자가 맞으면 왜 나옵니까? 틀린 총계? 미리 도움을 주셔서 감사합니다.

답변

0

계산이 잘못되었습니다. 9636 + 34640 + 29561 = 73837

+0

D' oh !!! 감사. –