- From: Henry S. Thompson <ht@inf.ed.ac.uk>
- Date: Tue, 15 Jun 2004 15:14:53 +0100
- To: Alexander Sherwood <asherwood@phs-net.com>
- Cc: xmlschema-dev@w3.org
This is a pretty extreme hack, but I needed a break from something else -- it's an object lesson in abusing identity constraints. If I've understood you correctly, it does what you want -- one or two address elements, type='mailing' must be present, type='payment' is also OK, either order if both present. <xs:element name="addresses"> <xs:complexType> <xs:sequence> <xs:element ref="address"/> <xs:element ref="address" minOccurs="0"/> </xs:sequence> <xs:attribute fixed="mailing" type="xs:token" name="mailing"/> </xs:complexType> <xs:keyref name="reqMailing" refer="keys"> <xs:selector xpath="."/> <xs:field xpath="@mailing"/> </xs:keyref> <xs:key name="keys"> <xs:selector xpath="address"/> <xs:field xpath="@type"/> </xs:key> </xs:element> <xs:element name="address"> <xs:complexType> <xs:attribute name="street"/> <xs:attribute name="city"/> <xs:attribute name="state"/> <xs:attribute name="zip"/> <xs:attribute name="type"> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="payment"/> <xs:enumeration value="mailing"/> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:complexType> </xs:element> Protective clothing should be warn when working with this schema :-) ht -- Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh Half-time member of W3C Team 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht@inf.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 Tuesday, 15 June 2004 10:15:27 UTC