2010-07-21 4 views
-1

나는 문제가 없습니다.xsl로 테이블 날짜 채우기 읽기

표는 이렇게이다 :

<table id="table"> 
     <tr> 
       <th>value</th> 
       <th>Total</th> 
     </tr> 
     <tr> 
       <td>x</td> 
       <td>100</td> 
     </tr> 
     <tr> 
       <td>y</td> 
       <td>101</td> 
     </tr> 
    </table> 

스크립트는 다음과 같습니다

var table = document.getElementById("table"); 
var value; 
var total = 0; 

for(i = 1; i < table.rows.length; i++){ 

    value = table.rows[i].cells[1].innerHTML; 
    total += parseInt(value);  
} 

이 괜찮습니다!

하지만 테이블이 XSL로 XML 파일에서 채울 경우 :

  <xsl:for-each select="fatture/fattura"> 
       <tr> 
        <td><xsl:value-of select="numero"/></td>       
       </tr> 
      </xsl:for-each> 

상단 스크립트는 ...

value = table.rows[i].cells[1].innerHTML; 
value = table.rows[i].cells[1].value; 
... 

테이블 태그 채우기를 읽기 기능은 무엇 괜찮되지 않는다 xsl로 ...?

+2

'나는 문제가 없습니다.'다음에 읽기를 중지했습니다. :) – willcodejavaforfood

답변

0

그것은

<xsl:for-each select="fatture/fattura"> 
    <tr> 
    <td><xsl:value-of select="name-or-something"/></td> 
    <td><xsl:value-of select="numero"/></td> 
    </tr> 
</xsl:for-each> 

있어야하지 않나요?

스크립트가 명시 적으로 세포

table.rows[i].cells[1].innerHTML 
//------------------^ 

를 참조되지만 현재 XSLT가 세포만을 생성하기 때문에.