If you have the XML below (where I want to get back the XML without the IDX tag or it's content)
<title>test title
<no-translation>no translation</no-translation> end no translation
<idx> <i1>index</i1></idx>
end idx
</title>
When using the XPath expression .//title//text()[not(parent::i1)] OR .//title//text()[not(ancestor::idx)] I can get the output of text which breaks into array:
Text='test title
'
Text='no translation'
Text=' end no translation
'
Text=' '
Text='
end idx
However what I want to get is not the text, but the element without the 'idx' tag:
<title>test title
<no-translation>no translation</no-translation> end no translation
end idx
</title>
But so far this seems to be impossible and doesn't appear to remove any content from the XML. Is there a way of using the [not(ancestor::idx)] with './title'?