tags:

views:

27

answers:

1

For instance, what XPath would return "text one", "text two", and "text three"?

<root>
<item>
   <richtext>
      <par>
         <break />
         text one
         <break />
         text two
         <break />
         text three
      </par>
   </richtext>
</item>
</root>

The number of <break/> tags varies.

+3  A: 

what XPath would return "text one", "text two", and "text three"?

Use:

string(/*/*/*/par)

This evaluates to the string value of the par element, which is (by definition) the concatenation of all its text-node descendents.

In case if you want to select all text nodes that a children of par (excluding the white-space-only text-nodes), use:

/*/*/*/par/text()[normalize-space()]
Dimitre Novatchev
+1 This is right.
Alejandro