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

Re: optional, but at least one required

From: Pete Cordell <petexmldev@tech-know-ware.com>
Date: Thu, 11 Oct 2007 15:38:39 +0100
Message-ID: <004f01c80c14$6ffd4e50$5d00a8c0@Codalogic>
To: "Michael Kay" <mike@saxonica.com>, "'Marie Bilde Rasmussen'" <mariebilderas@gmail.com>
Cc: "'Virginia Wiswell'" <vwiswell@verizon.net>, <xmlschema-dev@w3.org>

- Original Message From: "Michael Kay"

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

Hum, seems simple enough :-)

And, just to confirm that the simple case does not hide any nasties when 
extended up to bigger examples, Marie's case would simply be (ignoring the 
specific names):

    <xs:assert test="a|b|c|d|e|f|..."/>

BTW - If, in another schema snippet, I wanted either attribute A or element 
E, but not both, then my expression would be:

    <xs:assert test="@A and fn:not(E) or fn:not(@A) and E"/>

I don't think I can do the following though, because I can't do "...eq 1":

    <xs:assert test="op:count(@A|E) eq 1"/>

Is that the case?

Thanks,

Pete.
=============================================
Pete Cordell
Codalogic
for XML Schema to C++ data binding visit
 http://www.codalogic.com/lmx/
=============================================
Received on Thursday, 11 October 2007 14:39:07 GMT

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