Perhaps I have just discovered my own answer. Would you all agree this is the best way?

xquery /text[starts-with(@id, 'Bible.N')]//verse[@id='Rev.22.5']/following-sibling::node()[following-sibling::verse][1]

(simply limitie the returning sequence with [1])

On May 20, 2022, at 09:34, Mark Bordelon <markcbordelon@yahoo.com> wrote:

Gruss Gott, die Herren! Good day, fans and developers of basex!

After lots of searching online, I turn to you.

I have text loaded into my basex database in the following format

<text id=“Rev”>
...
<verse id="Rev.22.14"/>
Beati, qui lavant stolas suas in sanguine Agni : ut sit potestas eorum in ligno vitæ, et per portas intrent in civitatem.
<verse id="Rev.22.15"/>
Foris canes, et venefici, et impudici, et homicidæ, et idolis servientes, et omnis qui amat et facit mendacium.
<verse id="Rev.22.16”/>
...
</text>

If I wished to query the all nodes between <verse id="Rev.22.14”/> and the following <verse/> tag,
I imagined it would be as simple as this:
> xquery /text[starts-with(@id, 'Rev')]//verse[@id='Rev.22.1']/following-sibling::node()[following-sibling::verse]

But alas, the query does not stop searching at the following sibling, but continues to the end.

What is the correct syntax of the xpath to get what I need without specifying the particular end tag? I know the following works, but I require the more general query without the id of the ending tag.
> xquery /text[starts-with(@id, 'Bible.N')]//verse[@id='Rev.22.1']/following-sibling::node()[following-sibling::verse[@id='Rev.22.2’]].

Thanks for your help!

Mark Bordelon