DOM Level 3 XPath Specification text node questions

        I'm a little unclear about section 1.2.1 of the DOM Level 3 XPath
spec. The line "Instead of returning multiple nodes where XPath sees a
single logical text node, only the first non-empty DOM Text node of any
logical XPath text will be returned in the node set" seems to indicate
that the first DOM Text node (as opposed to DOM CDATA or DOM Entity
Reference nodes) is returned. Starting from this Text node, it's up to the
application to then determine what the entire set of nodes corresponding
to that string actually is. For example, say we have:

<first>
  <![CDATA[ one ]]>
  two
  <![CDATA[ three ]]>
  four 

  <second/>

  five  
</first>

        Then would the expression "/first/text()[1]" return the Text node
containing "two"? This means that if I wanted to get the string "one two
three four" I'd have to look at both previous and subsequent sibling nodes
to determine the node set I wanted. It'd make more sense for the cdata
node containing "one" to be returned.

Received on Thursday, 20 September 2001 05:54:51 UTC