Re: optional, but at least one required

- 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 UTC