xsl高手请进。怎么通过函数调用动态添加列
xml文件
<root>
<CellData>
<Cell CellOrdinal= "0 ">
<FmtValue> 11 </FmtValue>
</Cell>
<Cell CellOrdinal= "1 ">
<FmtValue> 20 </FmtValue>
</Cell>
<Cell CellOrdinal= "2 ">
<FmtValue> 20.0 </FmtValue>
</Cell>
<Cell CellOrdinal= "3 ">
<FmtValue> 23 </FmtValue>
</Cell>
<Cell CellOrdinal= "4 ">
<FmtValue> 37 </FmtValue>
</Cell>
</CellData>
</root>
xsl文件:有问题,怎么通过函数GetData()调用动态添加列
<xsl:stylesheet xmlns:xsl= "http://www.w3.org/TR/WD-xsl ">
<xsl:script>
function GetData(node)
{
var att=parseInt(node.getAttribute( "CellOrdinal "));
var sa = node.selectSingleNode( "./FmtValue ").text;
if(att> 2)
return sa;
}
</xsl:script>
<xsl:template match= "/ ">
<table border= "1 " width= "100% " height= "100px " cellspacing= "0 " cellpadding= "0 " style= "font-family:verdana;background-color:#FFFFFF ">
<tr>
<xsl:for-each select= "//root/CellData/Cell ">
<xsl:eval> <td> GetData(this) </td> </xsl:eval>
</xsl:for-each>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
[解决办法]
UP