关于XSL中count()的使用
2006-09-22 11:23:23 来源:WEB开发网XSL中用count()来取得xml中某种节点的个数
list.xml
<?xml version="1.0"?>
<list>
<application>
<id>1</id>
<state>1</state>
<type>111</type>
<title>title</title>
<applior>applior</applior>
<PRogress>
<node>
<state>pass</state>
<censor>admin</censor>
</node>
<node>
<state>failure</state>
<censor>kk</censor>
</node>
<node>
<state>detemind</state>
<censor>dq</censor>
</node>
</progress>
<applytime>2006-9-06</applytime>
<deadline>
<state>delay/ontime</state>
<time>2006-9-12</time>
</deadline>
</application>
</list>
要取得<node>节点的个数可以用的方法是
<xsl:value-of disable-output-escaping="yes" select="count(//node)"/>
路径以双斜线 // 开头, 则表示选择文档中所有满足双斜线//之后规则的元素(无论层级关系)
http://www.cnblogs.com/cosy/archive/2006/09/21/510185.html
更多精彩
赞助商链接