Let’s say I have the following XML file
<a id='123'> <b type='foo' value='1' /> <b type='baz' value='1' /> </a> <a id='789'> <b type='bar' value='12' /> </a> <a id='999'> <b type='foo', value='2' /> </a>
I want to get a list of all the ‘a’ nodes that have a ‘b’ subnode with a type=’foo’ and value=’1′. You can do something similar in jQuery with the ‘:has’ selector.
For the record I’m planning on using xmlstarlet on the command line (but I’m not married to doing it that way), so a xslt that works that way would be best.
something like this:
should do the trick