No, this is not the general solution yet.
Suppose that there is more markup in the text that is between the verse markers.
(And suppose the starting ID is 'Rev.22.15' since this ID is contained in your example.)
If the verse folling the start marker were like this:
Foris canes, et venefici, et<tag/> impudici, et homicidæ, et idolis servientes, et omnis qui amat et facit mendacium.
only this text node would be returned:
Foris canes, et venefici, et
I propose this XQuery instead:
let $text := <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<tag/> impudici, et homicidæ, et idolis servientes, et omnis qui amat et facit mendacium. <verse id="Rev.22.16"/> ... </text>, $start := $text//verse[@id = 'Rev.22.15'], $end := $start/following-sibling::verse[1] return $start/following-sibling::node()[. << $end]
Result: Foris canes, et venefici, et<tag/> impudici, et homicidæ, et idolis servientes, et omnis qui amat et facit mendacium.
There may be more compact pure XPath expressions, but they will probably be less legible.
Gerrit
On 20.05.2022 08:40, Mark Bordelon wrote:
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 mailto: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