I have an XML like this:
<engine-set>
<engine host-ref="blah1.com">
<property name="foo" value="true"/>
<property name="bar" value="true"/>
</engine>
<engine host-ref="blah2.com">
<property name="foo" value="true"/>
<property name="bar" value="false"/>
</engine>
</engine-set>
I want to match all engine elements that have a child node property with a name equal to "bar" and a value equal to "true". I find the fact that "true" appears in my XML, so my condition is always evaluated as true in the XPath expression. Is there any way? I am using Python and lxml.
EDIT:
My xpath expression (this does not work): // engine [(property / @ name = "bar" and property / @ value = "true")]
Thank,
G-man source
share