I’m trying to test if each specified parent node has one specified child node. For example, I have the following xml:
<feed>
<entry>
<cacheId/>
</entry>
<entry>
// missing cacheId
</entry>
</feed>
The second entry node doesn’t have a child cacheId node. I need either an overall true/false if every entry parent node has one cacheId node; or a list of true/false for each entry node if it has the cacheId node.
So for the above xml, I need either false or the list (true, false).
With XPath 2.0 you can get a sequence of boolean values:
/feed/entry/boolean(cacheId). With XPath 1.0 you are restricted tonot(boolean(/feed/entry[not(cacheId)])).