Danke schön, this gives me food for thought. My use case has actually expanded to query a list of nodes between the markers, given their initial markers, and thus with the output containing the initial markers as well, rather like this:
//verse[@id=("+syncTagIdList+")]/concat(@id, ' ', following-sibling::node()[following-sibling::verse][1])
and you are , of course, correct that there will be much markup between the verse markers, probably as much as this:
<sent>
<verse id="Rev.22.14"/>
<clause> <word>Beati</word>, <word>qui</word> <word>lavant</word> <word>stolas</word> ...
I do not mind the terse, illegible pure xpath solution if you can think of one….
Mark
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, etI 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.GerritOn 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
-- Gerrit ImsiekeGeschäftsführer / Managing Directorle-tex publishing services GmbHWeissenfelser Str. 84, 04229 Leipzig, GermanyPhone +49 341 355356 110, Fax +49 341 355356 510gerrit.imsieke@le-tex.de, http://www.le-tex.deRegistergericht / Commercial Register: Amtsgericht LeipzigRegisternummer / Registration Number: HRB 24930Geschäftsführer / Managing Directors:Gerrit Imsieke, Svea Jelonek, Thomas Schmidt