Problem with inline elements in XPath
Hello everybody,
I have a question concerning XPath expressions. Consider this XML
snippet:
<foo title="an attempt">
<ul>
<li>This works fine</li>
<li>Before the inline element <em>Inside the inline element</em> after
the inline element</li>
<li>This also works fine</li>
</ul>
</foo>
In order to reach the first list element, I would use the XPath expression "/foo/ul/li[1]", which works fine. (I get the first list element with "This works fine", as expected.)
However, I need an XPath expression that returns the second list
element in three "portions":
- "Before the inline element "
- "Inside the inline element"
- " after the inline element"
I can get the inside of the inline element with "/foo/ul/li/em", but I have no idea how to get the surrounding strings. Any ideas?
Re: Problem with inline elements in XPath
In article <eb4e5dda-302b-44cd-ba4e->,
This will return the text descendants of the <li> elements:
/foo/ul/li//text()
Please remember to mention me / in tapes you leave behind.
Re: Problem with inline elements in XPath
hi Reegan, Hello Richard,
Thank you very much, that seems to work!