XPath to find text node that is a sibling of other nodes

Posted by highlycaffeinated on Stack Overflow See other posts from Stack Overflow or by highlycaffeinated
Published on 2010-04-21T16:57:22Z Indexed on 2010/04/21 17:13 UTC
Read the original article Hit count: 201

Filed under:

Given the following fragment of html:

<fieldset>
  <legend>My Legend</legend>
  <p>Some text</p>
  Text to capture
</fieldset>

Is there an xpath expression that will return only the 'Text to capture' text node?

Trying

/fieldset/text()
yields three nodes, not just the one I need.

© Stack Overflow or respective owner

Related posts about xpath