我需要获取所有的"//ul/li[not(@*)][count(*)=0]",除了那些具有<div>父对象的。我尝试过"//not(div)/ul/li[not(@*)][count(*)=0]",但不幸的是它不起作用。有没有人知道,我该如何应对?提前谢谢。
发布于 2011-03-09 06:37:31
我认为你需要:
//ul[not(parent::div)]/li[not(@*|*)]或者:
/descendant-or-self::node()[not(self:div)]/ul/li[not(@*|*)]当它是根元素时,两者都会选择这样的ul。
发布于 2011-03-09 11:38:27
使用的
//*[not(self::div)]/li[not(@*) and not(*)]它可以略微缩写为等效的:
//*[not(self::div)]/li[not(@*|*)]https://stackoverflow.com/questions/5239058
复制相似问题