I am really new to xpath and was hoping that I could get some guidance. I have the following XML:
<dd class="conten1">
<li class="">
<b> Some text here </b>
<b> another text here </b>
<span class="date-range">2014 – Present</span>
</li>
</dd>
I have run the following xpath:
.//dd[contains(@class, 'conten1')]/li
and it returns:
Some text here another text here2014 - Present
How do I remove the "span" portion and only get
Some text here another text here
I have run
substring-before(.//dd[contains(@class, 'conten1')]/li,'201')
but this is not ideal as some of the entrees do not contain that span portion thus, would not be retrieved at all.
What I wish to grab is only the "Some text here another text here" portion consistently.
Really hope for some help and thank you in advance.
<b>elements only? All the text from non-<span>elements? The XPath expression'Some text here another text here'will give you what you asked for, but I assume that's not what you want.