<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">xs:error is defined in XSD 1.1 part 1:<div class=""><br class=""></div><div class=""><a name="key-error" id="key-error" title="" shape="rect" style="caret-color: rgb(133, 0, 33); color: rgb(133, 0, 33); font-family: sans-serif;" class="">[Definition:]  </a><span style="caret-color: rgb(133, 0, 33); color: rgb(133, 0, 33); font-family: sans-serif; font-size: medium; background-color: rgb(255, 255, 255);" class="">A special simple type definition, whose name is </span><b style="caret-color: rgb(133, 0, 33); color: rgb(133, 0, 33); font-family: sans-serif;" class=""><i class="">error</i></b><span style="caret-color: rgb(133, 0, 33); color: rgb(133, 0, 33); font-family: sans-serif; font-size: medium; background-color: rgb(255, 255, 255);" class=""> in the XSD namespace, is also present in each </span><a href="https://www.w3.org/TR/xmlschema11-1/#key-schema" class="termref" shape="rect" style="color: black; font-family: sans-serif; text-decoration: none;"><span class="arrow" style="font-weight: bold;">·</span>XSD schema<span class="arrow" style="font-weight: bold;">·</span></a><span style="caret-color: rgb(133, 0, 33); color: rgb(133, 0, 33); font-family: sans-serif; font-size: medium; background-color: rgb(255, 255, 255);" class="">. The </span><b style="caret-color: rgb(133, 0, 33); color: rgb(133, 0, 33); font-family: sans-serif;" class="">XSD <code style="font-size: 13px;" class="">error</code> type</b><span style="caret-color: rgb(133, 0, 33); color: rgb(133, 0, 33); font-family: sans-serif; font-size: medium; background-color: rgb(255, 255, 255);" class=""> has no valid instances. It can be used in any place where other types are normally used; in particular, it can be used in conditional type assignment to cause elements which satisfy certain conditions to be invalid.</span></div><div class=""><font color="#850021" face="sans-serif" size="3" class=""><span style="caret-color: rgb(133, 0, 33); background-color: rgb(255, 255, 255);" class=""><br class=""></span></font></div><div class=""><font color="#850021" face="sans-serif" size="3" class=""><span style="caret-color: rgb(133, 0, 33); background-color: rgb(255, 255, 255);" class="">In §3.16.7.3 it is defined as a union type with no member types.</span></font></div><div class=""><font color="#850021" face="sans-serif" size="3" class=""><span style="caret-color: rgb(133, 0, 33); background-color: rgb(255, 255, 255);" class=""><br class=""></span></font></div><div class=""><font color="#850021" face="sans-serif" size="3" class=""><span style="caret-color: rgb(133, 0, 33); background-color: rgb(255, 255, 255);" class="">I think that this call should fail on the grounds that () is not a valid instance of xs:error.</span></font></div><div class=""><font color="#850021" face="sans-serif" size="3" class=""><span style="caret-color: rgb(133, 0, 33); background-color: rgb(255, 255, 255);" class=""><br class=""></span></font></div><div class=""><font color="#850021" face="sans-serif" size="3" class=""><span style="caret-color: rgb(133, 0, 33); background-color: rgb(255, 255, 255);" class="">What's happening is apparently that when xs:error is used as a SequenceType, it is given a required cardinality of 0, and the type matching, when it sees a required cardinality of 0, allows an empty sequence to appear. I think the correct handling would be to have a required cardinality of 1.</span></font></div><div class=""><font color="#850021" face="sans-serif" size="3" class=""><span style="caret-color: rgb(133, 0, 33); background-color: rgb(255, 255, 255);" class=""><br class=""></span></font></div><div class=""><font color="#850021" face="sans-serif" size="3" class=""><span style="caret-color: rgb(133, 0, 33); background-color: rgb(255, 255, 255);" class="">Raised at </span><span style="caret-color: rgb(133, 0, 33);" class=""><a href="https://saxonica.plan.io/issues/4091" class="">https://saxonica.plan.io/issues/4091</a></span></font></div><div class=""><font color="#850021" face="sans-serif" size="3" class=""><span style="caret-color: rgb(133, 0, 33); background-color: rgb(255, 255, 255);" class=""><br class=""></span></font></div><div class=""><font color="#850021" face="sans-serif" size="3" class=""><span style="caret-color: rgb(133, 0, 33); background-color: rgb(255, 255, 255);" class="">Michael Kay</span></font></div><div class=""><font color="#850021" face="sans-serif" size="3" class=""><span style="caret-color: rgb(133, 0, 33); background-color: rgb(255, 255, 255);" class="">Saxonica<br class=""></span></font><div><br class=""><blockquote type="cite" class=""><div class="">On 12 Jan 2019, at 09:22, Adam Retter <<a href="mailto:adam.retter@googlemail.com" class="">adam.retter@googlemail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Whilst looking for a type which is declarable in XQuery but that<br class="">cannot be constructed, I wrote a strange query, well to me anyway,<br class="">which evaluates on Saxon 9.8.0.12 PE, and returns <hello/>.<br class=""><br class="">declare function local:test1($x as xs:error) {<br class="">  <hello/><br class="">};<br class="">local:test1(())<br class=""><br class="">You can also modify the query so the parameter has one-or-mode<br class="">cardinality e.g. "$x as xs:error+", and it will still evaluate with an<br class="">empty sequence as the argument. I believe that this is because<br class="">xs:error is always an empty type.<br class=""><br class="">BaseX and eXist-db both refuse to evaluate the query, saying that the<br class="">type xs:error is unknown.<br class=""><br class="">Am I right in thinking that Saxon evaluates this because it supports<br class="">[Schema 1.1 Part 2], whereas eXist-db and BaseX do not?<br class=""><br class="">Also if anyone has any bright ideas, about a type that I could<br class="">explicitly declare for a function argument, but that CANNOT be<br class="">constructed within XQuery, I would be interested to know. I think<br class="">Union types are out as I want to support all processors (i.e. not<br class="">require Schema support).<br class=""><br class="">So far I haven't seen anything...<br class=""><br class="">-- <br class="">Adam Retter<br class=""><br class="">skype: adam.retter<br class="">tweet: adamretter<br class=""><a href="http://www.adamretter.org.uk" class="">http://www.adamretter.org.uk</a><br class="">_______________________________________________<br class="">talk@x-query.com<br class="">http://x-query.com/mailman/listinfo/talk<br class=""></div></div></blockquote></div><br class=""></div></body></html>