Ah, thanks a lot! I would have never guessed this... Maybe the documentation should say something like: "Querying across elements is only supported when whitespace chopping is off." If it's ok with you, I'll add it.
Thanks; your edits are welcome.
Another question: The examples in the documentation and the actual behavior of BaseX suggest that ft:extract and ft:mark only work for queries on a single text node, [...]
Yes, that's true. In terms of the syntax, a dot (.) may work as well, if the addressed elements have no more descendant elements, as the following example shows:
x.xml: <x>A</x>
query: ft:mark(doc('x.xml')//x[. contains text 'a'])
Hope this helps, Christian