[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Issues with xs:error in the XPath 3.0 and XDM 3.0 Recommendations.


Subject: Re: [xsl] Issues with xs:error in the XPath 3.0 and XDM 3.0 Recommendations.
From: Graydon <graydon@xxxxxxxxx>
Date: Sat, 19 Apr 2014 22:38:29 -0400

On Sat, Apr 19, 2014 at 06:42:01PM -0700, Dimitre Novatchev scripsit:
> To put it in other words:  Why was the xs:error type introduced (in
> XML Schema)? What purpose does it serve? What problems does it solve?

http://lists.w3.org/Archives/Public/xmlschema-dev/2009Jul/0045.html (and
the rest of the thread) may be of interest.

xs:error would appear to be a result of conditional type assignment and
to allow

<element name="element" type="element">
     <alternative test="@name" type="localElement"/>
     <alternative test="@ref" type="elementRef"/>
     <alternative type="error"/>
</element>

as a way to define the schema "element" element, so that it must have a
name or a ref.  This is not something XSD 1.0 would allow.

There's also a case where you're using subset V of large shared
vocabulary P, and want to forbid element E in V when it is optional in P; 

<override schemaLocation="main.path.to.V">
     <element name="E" type="error"/>
     <!--* other elements can be excluded here by the same method ... *-->
</override>

That thread also has the cheerful acknowledgement that anything you can
do in XSD 1.1 with xs:error you can also do with assertions, but
xs:error is preferred for style and legibility.

-- Graydon


Current Thread
Keywords