RE: [XML Schema 1.1] I need an example that illustrates the usefulness of xs:error

Hi Michael,

> A schema for XSLT, for example, might enforce a rule that
> XSLT templates must have either a name or a match attribute
> by declaring the xsd:template element thus:
> 
>    <element name="template">
>      <alternative test="@name" type="xslt:named-template"/>
>      <alternative test="@match" type="xslt:template"/>
>      <alternative type="xsd:error"/>
>    </element>

Doesn't this achieve the same result (I simply omitted the third alternative):

   <element name="template">
     <alternative test="@name" type="xslt:named-template"/>
     <alternative test="@match" type="xslt:template"/>
   </element>

In this version an error is generated if there is neither a name attribute or a match attribute.

I like this one:

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

Thanks.

/Roger

Received on Wednesday, 22 July 2009 17:58:32 UTC