W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2009

RE: inheritable attribute declarations

From: Michael Kay <mike@saxonica.com>
Date: Fri, 14 Aug 2009 03:15:19 +0100
To: 'Mukul Gandhi' <gandhi.mukul@gmail.com>, xmlschema-dev@w3.org
Message-id: <5FCEC65755EB4E6984ABD539DB15EF47@Sealion>
>    I have following questions about inheritable attributes, 
> in XML Schema 1.1.

Good questions, and I had to do some careful reading to find the answers. 
> 
> 1. supposing there is an attribute declaration, like following:
> 
> (a global declaration, and child of xs:schema element)
> 
> <xs:attribute name="TEST_ATTR" type="xs:integer" />
> 
> then, can I define an attribute reference like following?
> 
> (part of complex type definition)
> 
> <xs:attribute ref="TEST_ATTR" inheritable="true" />

Yes, you can.
> 
> 2. supposing, we have following attribute declarations 
> present in XML Schema 1.1:
> 
> (a global declaration, and child of xs:schema element)
> 
> <xs:attribute name="TEST_ATTR" type="xs:integer" 
> inheritable="false" />
> 
> (part of complex type definition)
> 
> <xs:attribute ref="TEST_ATTR" inheritable="true" />
> 
> These two attribute declarations have conflicting 
> inheritable=xs:boolean values (one is true, and other is false).
> 
> Should the XML Schema 1.1 processor, give an error in this 
> case? or, one of the inheritable declarations (either name=.. 
> or ref=..) will take precedence (if yes, then which one)?
> 

The value on the reference takes priority over the one on the declaration.
This is the same rule as for "fixed" and "default". The relevant rule is in
3.2.2.3, the Mapping Rules for References to Top-level Attribute
Declarations, where it says that the value of the {inheritable} property on
the attribute use component is: "The .actual value. of the inheritable
[attribute], if present, otherwise {attribute declaration}.{inheritable}.";
and when it comes to validation rules, it's the property on the attribute
use that counts, except in the case where there is no relevant attribute use
(for example, if the attribute matches a wildcard), in which case it's the
value on the declaration that counts.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 
Received on Friday, 14 August 2009 02:15:58 GMT

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