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

Re: alternative obligatory attributes

From: G. Ken Holman <gkholman@CraneSoftwrights.com>
Date: Thu, 12 Mar 2009 13:59:41 -0400
Message-Id: <7.0.1.0.2.20090312135659.026438c0@wheresmymailserver.com>
To: <xmlschema-dev@w3.org>
At 2009-03-12 18:06 +0100, Klöck, Erwin wrote:
>is it possible to define alternative obligatory 
>attributes for an element? What I want is something like the following,
>where the element otto must have either of two 
>attributes but not both. If it is possible, how would one do this?
>
><top>
>         <file uri="xxxx"/>
>         <file relative-path="yyyy"/>
></top>

No, when using W3C Schema 1.0, because sibling 
elements of the same name cannot have different validation constraints.

Yes, when using W3C Schema 1.1 (using 
assertions), or ISO/IEC 19757-3 Schematron (using 
assertions) or ISO/IEC 19757-2 RELAX-NG (using a 
choice pattern on the attributes).

I hope this helps.

. . . . . . . . . . . . . Ken

--
XQuery/XSLT training in Prague, CZ 2009-03 http://www.xmlprague.cz
XQuery/XSLT/XSL-FO training in Los Angeles (New dates!) 2009-06-08
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/x/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal
Received on Thursday, 12 March 2009 18:00:32 GMT

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