Given this html:
<ul>
<li>This is <a href="#">a link</a></li>
<li>This is <a href="#">another link</a>.</li>
</ul>
How can I use XPath to get the following result:
[
'This is a link',
'This is another link.'
]
What I've tried:
//ul/li/text()
But this gives me ['This is ', 'This is .']
(withoug the text in the a
tags
Also:
string(//ul/li)
But this gives me ['This is a link']
(so only the first element)
Also
//ul/li/descendant-or-self::text()
But this gives me ['This is ', 'a link', 'This is ', 'another link', '.']
Any further ideas?