Here is sample XML:
<Root>
<A>
<B>
<C>Yes</C>
</B>
</A>
:
<A>
<B>
<C>No</C>
</B>
</A>
</Root>
There can be any # of nested <A> with values of either Yes or No. I would
like to select <A> node(s) based on value of <C>. In pseudo code:
Give me all <A> where <C> = "Yes" (or "No). So far I was able to select all
"Yes" (or "No") but these are <C> nodes and need their grandparents.
TIA
Peter Flynn - 29 Aug 2007 23:25 GMT
> Here is sample XML:
>
[quoted text clipped - 17 lines]
> Give me all <A> where <C> = "Yes" (or "No). So far I was able to select all
> "Yes" (or "No") but these are <C> nodes and need their grandparents.
In XPath, //A[descendant::C='Yes'] or possibly //C[.='Yes']/ancestor::A
///Peter

Signature
XML FAQ: http://xml.silmaril.ie/