2011-12-14 22 views

Respuesta

9

Trate doc.xpath("//pod[@id='anid' or @id='anotherid']")

+0

perfecta, que funcionó! Sin embargo, esa no es la sintaxis XPath 2.0, ¿verdad? –

+0

@MarkF No, no lo es, es XPath 1.0. En XPath 'o' funciona como un operando (como' algo o algo'), ** no ** como una función (como 'o (algo, algo)'). – jasso

+0

Entendido, gracias. –

3

Prueba este XPath:

doc.xpath("//pod[@id='anid' or @id='anotherid']") 
0

Esto también trabajó para mí:

sect_pr.xpath("//pod[@id='anid']", "//pod[@id='anotherid']") 

Devuelve NodeSet

que tiene un código como éste:

sect_pr.xpath('//w:headerReference or //w:footerReference') 

y devolverlo true insted nodeset