Given the following XML:
<root>
<a>
<b>Correct</b>
</a>
<a>
<b>Correct</b>
</a>
<a>
<b>Oh no!</b>
</a>
</root>
I need a XPath query, that will ensure that every <b>-Node has the value “Correct”.
Do you have any ideas? Any help is much appreciated.
If you mean “select all correct nodes”, you can use
/root/a/b[text() = 'Correct']which will return a node set.If you mean “check whether all nodes are correct” you can use
every $i in /root/a/b/text() satisfies $i = 'Correct'which will return a boolean.