> Thanks for taking the time to look at this so quickly. I'm still unsure how
> #2 isn't a sequence if #3 is.
Do you mean the result of #2 and #3? All results (values) of XQuery
expressions are "sequences" (with 0 or more items), so the result of
#2 is a sequence as well.
> I'm just a bit surprised that text nodes and element nodes are returned
> differently.
This is actually not about text or element nodes, it’s about
descendant vs. child axis:
The following two queries are identical:
$node//text()[1]
$node/descendant-or-self::node()/child::text()[1]
If evaluated, you will get the first child text node of all nodes of
$node. In contrast..
($node//text())[1]
$node/descendant::text()[1]
..will give you the first descendant text node of $node. Do you see
the difference?
Hope this helps,
Christian