[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: [XML Schema 1.1] A little confused about inheritable attributes

From: Michael Kay <mike@saxonica.com>
Date: Mon, 29 Jun 2009 19:07:23 +0100
To: "'Costello, Roger L.'" <costello@mitre.org>, <xmlschema-dev@w3.org>
Message-ID: <64A67A7A3E6D49F295C3FA3569F101F7@Sealion>
RE: [XML Schema 1.1] A little confused about inheritable attributes
Whether or not the attributes start-time and end-time can appear on the
Beverage element is determined by the type definition of BeverageType (and
its two alternatives), which you have not shown us. If they don't mention
these attributes, then they can't appear. They are merely treated as if they
appeared for the purpose of evaluating the alternative tests.

We did consider a different approach where "inheritable" was another way of
defining a default value for an attribute. But some felt that was a step too
far. The current design is a bit of a compromise - it was motivated
particularly by use cases involving xml:lang.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 



> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Costello, Roger L.
> Sent: 29 June 2009 18:46
> To: xmlschema-dev@w3.org
> Subject: [XML Schema 1.1] A little confused about inheritable 
> attributes
> 
> 
> Hi Folks,
> 
> I know that by declaring an attribute to be inheritable, 
> nested elements can use the attribute in their <assert> and 
> <alternative> elements.
> 
> But suppose an attribute is declared to be both inheritable 
> and required (use="required"). Does that mean nested elements 
> must display that attribute in instance documents?
> 
> For example, <Meeting> has two required, inheritable attributes:
> 
> <element name="Meeting">
>     <complexType>
>         <sequence>
>             <element name="Beverage" type="b:BeverageType">
>                <alternative test="@end-time le '12:00:00'" 
> type="b:MorningBeverage" />
>                <alternative test="@end-time gt '12:00:00'" 
> type="b:AfternoonBeverage" />
>             </xs:element>
>         </sequence>
>         <attribute name="start-time" type="xs:time" 
> use="required" inheritable="true" />
>         <attribute name="end-time" type="xs:time" 
> use="required" inheritable="true" />
>     </complexType>
> </element>
> 
> In an instance document must the <Beverage> element have the 
> two inherited attributes:
> 
> <Meeting start-time="___" end-time="___">
> 
>     <Beverage start-time="___" end-time="___">
>         ...
>     </Beverage>
> 
> </Meeting>
> 
> 
> 
> /Roger
Received on Monday, 29 June 2009 18:08:01 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.