W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2002

Re: Attribute Uses

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 07 Jun 2002 09:05:35 +0100
To: Jeni Tennison <jeni@jenitennison.com>
Cc: xmlschema-dev@w3.org, John Verhaeg <jverhaeg@metamatrix.com>
Message-ID: <f5b4rgfbjjk.fsf@cogsci.ed.ac.uk>

Jeni Tennison <jeni@jenitennison.com> writes:

> > The "Attribute Use" described in section 3.2.2 of the Structures
> > spec when a "ref" attribute is present seems to indicate that, if
> > present, the default/fixed value must match the value specified in
> > the declaration (the globally defined Attribute):
> >
> > "value constraint} If there is a default or a fixed [attribute]
> > <http://www.w3.org/TR/xml-infoset/>, then a pair consisting of the ·actual
> > value· (with respect to the {type definition} of the {attribute
> > declaration}) of that [attribute] <http://www.w3.org/TR/xml-infoset/> and
> > either default or fixed, as appropriate, otherwise ·absent·."
> 
> From what I can tell, what this says is that when you refer to a
> global declaration for an attribute, then the value constraint
> specified on that global declaration is completely ignored. All that
> matters is whether the xs:attribute element has a default/fixed
> attribute on it or not; if it doesn't, then there's no value
> constraint. [This seems a bit strange to me, as I'd expect the
> attribute declaration to be able to supply a default default/fixed
> value, but I think that's what this is saying.]
> 
> When it says "with respect to the {type definition} of the {attribute
> declaration}" it's talking about interpreting the value of the
> fixed/default attribute based on the simple type of the attribute, as
> declared in the attribute declaration. So for example if you had:
> 
> <xs:attribute name="date" type="xs:date" />
> 
> and then:
> 
>   <xs:attribute ref="date" default="  2002-06-06  " />
> 
> then the value '2002-06-06' would be interpreted as a date rather than
> a string (and thus have whitespace stripped, for example).
> 
> > However, item 4 of Validation Rule: Attribute Locally Valid in
> > section 3.2.4 states:
> >
> > "4 The item's ·actual value· must match the value of the {value
> > constraint}, if it is present and fixed. "
> 
> This is talking about the fact that if an attribute use's {value
> constraint} isn't absent, and is fixed (i.e. there's a fixed attribute
> on the xs:attribute element in the schema), then the attribute in the
> instance document must have that value.
> 
> > This seems to indicate that default values can be overridden in
> > Attribute Uses. XML Spy seems to allow the value to be overridden
> > regardless of whether the value constraint is fixed or default.
> 
> I think it's correct that default and fixed values can both be
> overridden (in fact the ones on global attribute declarations are
> ignored, so they are *always* overridden), and that, from your
> description, XML Spy is performing correctly.

There's one misunderstanding above, and one bug in the REC.

Misunderstanding: In the interesting case, i.e. where there is a local use
with a ref to a global attr decl:

  1) If the global has a fixed value, the local must have the same fixed
  value, or no fixed or default at all.  In either case the fixed
  value will be enforced.

  2) When restrictions are checked, the same fallback is applied to
  ensure that no change of fixed value occurs

Bug: In the same case, when validating an element info item with the
relevant attribute info item missing, the global default is _not_
specified as being installed.  It should be, I'll raise an erratum
request.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2002, 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/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]
Received on Friday, 7 June 2002 04:05:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:31 GMT