XML example:
<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 the destination / destination / option / value nodes, where the "name" attribute of the nodes is "MaxFeedbackAttempts" and the contents of the nodes are "-1". That is, I want to return every node that looks like this:
<value name="MaxFeedbackAttempts">-1</value>
I can get each assignment / assignment / parameters / value of a node with the specified attribute using:
//assignment/options/value[@name="MaxFeedbackAttempts"]
I'm just not sure how to refine this path to also limit the results based on the contents of the nodes. Is there a way to do this using XPath?
source share