count 函数 (XPath)

返回 node-set 参数中的节点数。

number count(node-set)

示例

XML 文件 (test.xml)

XSLT 文件 (test.xsl)

输出

应用于上述 XML 文件的 XSLT 样式表将产生下列结果:

node-set count(node-set)

//x

7

//x[1]

4

//x/y

8

//x/y[1]

4

//x[1]/y[1]

2

另请参见

参考

XML 数据类型引用