This query:

declare variable $metadata as xs:anyAtomicType := doc('libx2_meta')/metadata;
let $roots := $metadata/roots[@document="libx2_feed"]/id
return ...

produces

[XPTY0019] Context node required for roots[@document = "libx2_feed"]; xs:untypedAtomic found.

in BaseX 6.2.7, but it works in 6.2.3

Is this correct?

Substituting the declare variable with a let $metadata := ... works, so no showstopper here.

On a related note, declaring a function "as xs:anyAtomicType()*" behaves differently in 6.2.7 than in 6.2.3. I suppose the correct semantics for this is to cast the result to an anyAtomicType; 6.2.3 did not do that but 6.2.7 does.

 - Godmar