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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.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
xpath条件选择&x27;tr';数量为';td'&燃气轮机;2._Xpath - Fatal编程技术网

xpath条件选择&x27;tr';数量为';td'&燃气轮机;2.

xpath条件选择&x27;tr';数量为';td'&燃气轮机;2.,xpath,Xpath,虽然这似乎是正确的(?),但它在firefox49/firebug和chrome开发工具53.0.2785.116中都不匹配 //table[@id="foobar"]/tbody/tr[count("td") > 2] 我尝试选择所有tr函数中count()为td>2的tr函数需要一个节点集作为参数。不要将td置于引号中: //table[@id="foobar"]/tbody/tr[count(td) > 2] 有趣的是,应用于非节点集的count()是XPath 1.0中定

虽然这似乎是正确的(?),但它在firefox49/firebug和chrome开发工具53.0.2785.116中都不匹配

//table[@id="foobar"]/tbody/tr[count("td") > 2]
我尝试选择所有
tr
函数中
count()
td
>2的
tr
函数需要一个节点集作为参数。不要将
td
置于引号中:

//table[@id="foobar"]/tbody/tr[count(td) > 2]

有趣的是,应用于非节点集的count()是XPath 1.0中定义的少数动态错误之一。但是XPath1.0对于如何处理动态错误非常不明确,但是它以静默方式失败,没有DOM错误之类的错误。只是控制台说:没有匹配的节点啊,谢谢,我每天都在使用
document.querySelector('td')
:D在同时使用CSS和Xpath选择器时,有时会感到困惑。