I think you may have found a bug in eXist-db. Your code can be reduced to the following tests:
Works in eXist-db: ('A','B','C','D') ! element {.} {'Z'} Fails with the undefined static context error. ('A','B','C','D') ! (let $x := 1 return element {.} {'Z'}) You may wish to report this on exist-open. Joe _______________________________________________ talk@x-query.com http://x-query.com/mailman/listinfo/talk