有沒有辦法使用Nokogiri的xpath()
來完成以下工作?Nokogiri xpath()'or'operator?
doc.xpath("//pod[@id=or('anid','anotherid')]")
有沒有辦法使用Nokogiri的xpath()
來完成以下工作?Nokogiri xpath()'or'operator?
doc.xpath("//pod[@id=or('anid','anotherid')]")
嘗試doc.xpath("//pod[@id='anid' or @id='anotherid']")
試試這個XPath:
doc.xpath("//pod[@id='anid' or @id='anotherid']")
這也爲我工作:
sect_pr.xpath("//pod[@id='anid']", "//pod[@id='anotherid']")
它返回NodeSet
我有這樣的代碼:
sect_pr.xpath('//w:headerReference or //w:footerReference')
,並返回true
insted的NODESET
完美,那工作!這不是XPath 2.0的語法,對吧? – 2011-12-14 21:42:31