I have a collection of 1000s of TEI documents in the variable $data
(note: the top-most node in each document is tei:TEI
).
Within Xpath (under Xquery) I can output all the @type="example"
documents with:
let $coll := $data/tei:TEI[@type="example"]
return $coll
I can then further extract one document from the above result with:
let $coll := $data/tei:TEI[@type="example"]
return $coll[@xml:id="TC0005"]
The above work fine.
Now, I would like to get the documents before and after a certain document, which I assume could be done with preceding-sibling
/ following-sibling
:
let $coll := $data/tei:TEI[@type="example"]
return ($coll[@xml:id="TC0005"]/preceding-sibling[1],
$coll[@xml:id="TC0005"],
$coll[@xml:id="TC0005"]/following-sibling[1])
However the above only returns the document for $coll[@xml:id="TC0005"]
.
Is this syntax correct for navigating document to document within the collection?
Many thanks.