Z
Zachary Turner
I want to select some nodes based on whether or not another node
exists in another part of the document with the exact same name.
For example,
<special-location>
<special-element value="some-element"/>
<special-element value="some-element-two"/>
</special-location>
<root>
<some-element .../>
<some-element-two .../>
<some-other-element .../>
</root>
What I want to do is select only the first and second elements under
<root>, and ignore the third element since there is no <special-
element> node with @value=some-other-element.
Is this possible with a simple XPath, or do I need to use more
complicated logic and branching structures?
exists in another part of the document with the exact same name.
For example,
<special-location>
<special-element value="some-element"/>
<special-element value="some-element-two"/>
</special-location>
<root>
<some-element .../>
<some-element-two .../>
<some-other-element .../>
</root>
What I want to do is select only the first and second elements under
<root>, and ignore the third element since there is no <special-
element> node with @value=some-other-element.
Is this possible with a simple XPath, or do I need to use more
complicated logic and branching structures?