Sample XML:
<assignments>
<assignment id="911990211" section-id="1942268885" item-count="21" sources="foo">
<options>
<value name="NumRetakes">4</value>
<value name="MultipleResultGrading">6</value>
<value name="MaxFeedbackAttempts">-1</value>
<value name="ItemTakesBeforeHint">1</value>
<value name="TimeAllowed">0</value>
</options>
</assignment>
<assignment id="1425185257" section-id="1505958877" item-count="4" sources="bar">
<options>
<value name="NumRetakes">0</value>
<value name="MultipleResultGrading">6</value>
<value name="MaxFeedbackAttempts">3</value>
<value name="ItemTakesBeforeHint">1</value>
<value name="TimeAllowed">0</value>
</options>
</assignment>
<assignments>
Using XPath, I would like to select all assignments/assignment/options/value nodes where the nodes "name" attribute is "MaxFeedbackAttempts" and the nodes content is "-1". That is to say, I want to return each node that looks like:
<value name="MaxFeedbackAttempts">-1</value>
I can get each assignments/assignment/options/value node with the specified attribute using:
//assignment/options/value[@name="MaxFeedbackAttempts"]
I am just not sure how to refine this path to also limit the results based on the nodes content. Is there any way to do this using XPath?