Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml XPath count()函数_Xml_Xpath - Fatal编程技术网

Xml XPath count()函数

Xml XPath count()函数,xml,xpath,Xml,Xpath,假设我有一个XML树,如下所示: proceedings -name -contents -article -author -title -pages 如何识别只有一位作者的标题?以及有三位以上作者使用XPath的文章数量?标题有一位作者: /proceedings/contents/article[count(author)=1]/title 作者超过三位的文章数量: count(/proceedings/con

假设我有一个XML树,如下所示:

proceedings
   -name
   -contents
      -article
         -author
         -title
         -pages
如何识别只有一位作者的标题?以及有三位以上作者使用XPath的文章数量?

标题有一位作者:

/proceedings/contents/article[count(author)=1]/title
作者超过三位的文章数量:

count(/proceedings/contents/article[count(author)>3])

无论哪种方式,我都可以使用//来表示孩子的父母。在本例中,
//文章[count(author)=1]/title
。非常感谢弗朗西斯!