I would like to select only the horse nodes that have the attribute finished="true". However I would also like those horse node(s) wrapped in the race and meeting nodes which is the part I am having trouble with.
This returns all the horse nodes but doesn't return the race or meeting nodes: //race/horse[result/@finished='true']
I thought I might be able to use this: //meeting[race/horse/result/@finished='true']
or this: //meeting[race/horse/result/@finished='true']|//meeting/race[horse/resul t/@finished='true']
But this one just seems to return all the horse nodes rather than just the one: I am expecting this result from the above xml: