Example of what I'm looking for. Here is the input:
<AAA>
<BBB id='1'>
<CCC id='1'>
<DDD id='1'/>
<DDD id='2'/>
</CCC>
<CCC id='2'>
<DDD id='3'/>
<DDD id='4'/>
</CCC>
</BBB>
<BBB id='2'>
<CCC id='3'>
<DDD id='5'/>
<DDD id='6'/>
</CCC>
<CCC id='4'>
<DDD id='7'/>
<DDD id='8'/>
</CCC>
</BBB>
</AAA>
Here is the node set I want to select (DDD with id 1, it's parent and grandparent):
<BBB id='1'>
<CCC id='1'>
<DDD id='1'/>
</CCC>
</BBB>
In other words, the direct line from self to grandparent, and only those nodes.