[xquery-talk] xs:error and AbstractTypes

Adam Retter adam.retter at googlemail.com
Sat Jan 12 01:22:55 PST 2019

Whilst looking for a type which is declarable in XQuery but that
cannot be constructed, I wrote a strange query, well to me anyway,
which evaluates on Saxon PE, and returns <hello/>.

declare function local:test1($x as xs:error) {

You can also modify the query so the parameter has one-or-mode
cardinality e.g. "$x as xs:error+", and it will still evaluate with an
empty sequence as the argument. I believe that this is because
xs:error is always an empty type.

BaseX and eXist-db both refuse to evaluate the query, saying that the
type xs:error is unknown.

Am I right in thinking that Saxon evaluates this because it supports
[Schema 1.1 Part 2], whereas eXist-db and BaseX do not?

Also if anyone has any bright ideas, about a type that I could
explicitly declare for a function argument, but that CANNOT be
constructed within XQuery, I would be interested to know. I think
Union types are out as I want to support all processors (i.e. not
require Schema support).

So far I haven't seen anything...

Adam Retter

skype: adam.retter
tweet: adamretter

More information about the talk mailing list