[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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>
Re: optional

- 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

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.