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>
<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>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货