W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2007

RE: optional, but at least one required

From: Michael Kay <mike@saxonica.com>
Date: Thu, 11 Oct 2007 14:38:13 +0100
To: "'Pete Cordell'" <petexmldev@tech-know-ware.com>, "'Marie Bilde Rasmussen'" <mariebilderas@gmail.com>
Cc: "'Virginia Wiswell'" <vwiswell@verizon.net>, <xmlschema-dev@w3.org>
Message-ID: <005301c80c0b$fa2a2a20$4063a8c0@turtle>

> XSD1.1 is looking at adding an xs:assert schema directive 
> that includes a set of xpath expressions that a construct 
> (sequence/choice/etc.) must satisfy.  I would be interested 
> to know how complicated such an expression for this use-case 
> would be if anyone cared to submit an example.

You can write it as

    <xs:element ref="a" minOccurs="0"/>
    <xs:element ref="b" minOccurs="0"/>
  <xs:assert test="a|b"/>

Michael Kay
Received on Thursday, 11 October 2007 13:38:31 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:44 UTC