简体   繁体   English

XQuery计数所有节点

[英]XQuery Count all Nodes

Is there a way to select the sum of all nodes within 1 XML nocument 有没有一种方法可以选择1个XML文件中所有节点的总和

for $c in doc("http://www.dbis.informatik.uni-goettingen.de/Mondial/mondial.xml")
return count($c//country)

That is what i currently have but this only returns the count of all top level nodes. 那就是我目前拥有的东西,但这只会返回所有顶级节点的数量。 I would like to count all existing nodes.(recursively?) 我想计算所有现有节点。(递归吗?)

要计算此XML文档中的所有节点,以下XPath表达式就足够了:

count(doc("http://www.dbis.informatik.uni-goettingen.de/Mondial/mondial.xml")//node())

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM