I'm having trouble writing an XPath expression to select nodes that contain certain elements, while excluding siblings of this element that I'm not interested in. I suspect this can't be done with XPath alone and that I will need to use XSLT.
Using this source document
<items>
<item id="foo1">
<attr1>val1</attr1>
<attr2>val2</attr2>
<attr3>val3</attr3>
<interestingAttribute>val4</interestingAttribute>
</item>
<item id="foo2">
<attr1>val5</attr1>
<attr2>val6</attr2>
<attr3>val7</attr3>
</item>
<item id="foo3">
<attr1>val8</attr1>
<attr2>val9</attr2>
<attr3>val10</attr3>
<interestingAttribute>val11</interestingAttribute>
</item>
</items>
I would like to generate this result
<items>
<item id="foo1">
<interestingAttribute>val4</interestingAttribute>
</item>
<item id="foo3">
<interestingAttribute>val11</interestingAttribute>
</item>
</items>
Can this be done with XPath? If not, what XSLT transformation should I use?