//text()[preceding::*[contains(text(),'Term:')] and following::*[contains(text(),'Term:')]]
This is the same as empo suggested. However, I am looking for a node containing Term and returning all text nodes between them.
However, this only works fine if you don't have another "Term" set. Let me know if this is the case, because then this Xpath will also return some unwanted values.
Since then you have updated the input. I just added one more condition to the previous Xpath.
//text()[preceding::*[contains(text(),'Term:')] and following::*[contains(text(),'Term:')] and not(contains(., 'Term:'))]
The @empo solution also works. But we take into account <strong> . The Xpath I wrote just checks the word "Term:" and prints out all the text nodes between them.
Let me know if this works for you.
Sincerely.
source share