I need to select a Children node that contains only boy Child nodes.
From this XML:
<Parent>
<Name>Mary</Name>
<Sex>female</Sex>
<Children>
<Child>
<Name>Joe</Name>
<Sex>boy</Sex>
</Child>
<Child>
<Name>Harry</Name>
<Sex>boy</Sex>
</Child>
<Child>
<Name>Sue</Name>
<Sex>girl</Sex>
</Child>
<Child>
<Name>Connie</Name>
<Sex>girl</Sex>
</Child>
<Child>
<Name>Kim</Name>
<Sex>other</Sex>
</Child>
</Children>
</Parent>
I need this result:
<Children>
<Child>
<Name>Joe</Name>
<Sex>boy</Sex>
</Child>
<Child>
<Name>Harry</Name>
<Sex>boy</Sex>
</Child>
</Children>
This xpath gives me the right Child nodes - but not inside a Children node.
//Children/Child[Sex='boy']
This xpath gives me the Children node I want - but with all the Child nodes inside - not just the boys.
//Children[Child/Sex='boy']
Can it be done with xpath?