I want this output (example):
I want this
I'm working with a XML/TEI document and I need to work with XPath expression and I want as output the text in the div/u, but without the text inside node element like "desc" or "vocal><desc" or the text between "anchor/><anchor/" (example).
From the code (example):
<div>
<u>
I want this but
*<anchor/><desc>I don't want this</desc><anchor/>
<anchor/>I don't want this also<anchor/>
<del type="">I don't want this too</del>*
I want this
</u>
</div>
I tried to use (example) :
TEI//u[not(desc)]
But it excludes every <u> with <desc> inside.
If I read your requirements as:
select any text node that is a child of
u(i.e. not inside another element such asdescordel), but exclude text nodes that are in-between twoanchorelementsthen I arrive at the following expression:
Applying it to the given input produces:
which is different from the output you say you want, but nevertheless conforms to the stated requirements.