Re: fixed and default

Ian Stokes-Rees <ijs@decisionsoft.com> writes:

> Section 2.2.1 of the XSDL Primer states:
> 
> Note that the concepts of a fixed value and a default value are mutually
> exclusive, and so it is an error for a declaration to contain both
> fixed and default attributes.
> 
> And yet the schema for schemas does nothing to assert the mutual
> exclusivity of "fixed" and "default".

It can't, it's outside the expressive power of XML Schema as it
stands.  This constraint is expressed in the spec. at [1] and [2].

> I just tried the Primer
> po.xsd schema on XSV with the modification of adding a
> 'default="UK"' attribute and it reported that the schema was fine,
> indicating to me that the schema for schemas is not actually
> definitive (or normative) -- a problem, since the schema is
> _supposed_ to be.

Sure it's normative, and that the modified schema _doesn't_ fail to
validate per the sForS doesn't mean it's an OK schema document -- as
the spec. [3] makes clear, that requires not only schema-validity per
the sForS, but also conformance to all the Schema Representation
Constraints, which are what I cited above.

> It would seem to me that this would have been an early hint that
> "choice" should have applied to attributes as well.  Since this is
> not the case, what is the standard way to implement selection
> between multiple mutually exclusive attributes when creating a
> schema?

Wait for Schema 1.1, or use Schematron today.

> Also, what was the reason for not allowing choice to operate over attributes?

It's one (relatively simple) example of what we call co-constraints,
which we wish to provide a general solution for.

ht

[1] http://www.w3.org/TR/xmlschema-1/#src-attribute
[2] http://www.w3.org/TR/xmlschema-1/#src-element
[3] http://www.w3.org/TR/xmlschema-1/#conformance-schemaValidity
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/

Received on Friday, 20 April 2001 11:02:59 UTC