XPath count() 函数 [英] XPath count() function
本文介绍了XPath count() 函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我有一个 XML 树,如下所示:
Suppose I have an XML tree as below:
proceedings
-name
-contents
-article
-author
-title
-pages
如何识别只有一个作者的任何标题?以及使用 XPath 的作者超过 3 人的文章数量?
How can I identify any title that has only one author? And the number of articles that have more than three author using XPath?
推荐答案
一个作者的标题:
/proceedings/contents/article[count(author)=1]/title
作者超过三位的文章数量:
Number of articles with more than three authors:
count(/proceedings/contents/article[count(author)>3])
这篇关于XPath count() 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文