- From: Rick Jelliffe <ricko@topologi.com>
- Date: Thu, 13 Jun 2002 04:44:01 +1000
- To: <xmlschema-dev@w3.org>
Torsten Curdt <tcurdt@dff.st> wrote: -------------------------------------------------------------------------- I am trying to have a mixture of ordered and unordered elements: <root> <seq1/> <seq2/> <unordered2/> <unordered1/> </root> ------------------------------------------------------------------------- For these kind of complex requirements, it may be easier to layer rather than attempt baroque content models: <xs:element name="root"> <xs:complexType> <xs:all> <!-- All in the family --> <xs:element name="seq1"/> <xs:element name="seq2"/> <xs:element name="unordered1"/> <xs:element name="unordered2"/> </xs:all> </xs:complexType> <xs:annotation> <xs:appinfo> <pattern xmlns="http://www.ascc.net/xml/schematron"> <rule context="root"> <!-- Who's on first --> <assert test="*[1][self::seq1]" /> <assert test="*[2][self::seq2]" /> </rule> </pattern> </xs:appinfo> </xs:annotation> </xs:element> </xs:schema> with the proviso that ifever "root" is used as a local element name with a different content model you will need to factor that in (such as <rule context="root[not(parent::fred)]"> which breaks encapsulation. Cheers Rick Jelliffe
Received on Wednesday, 12 June 2002 14:31:16 UTC