XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] RELAX NG require oneOrMore optional elements

You can do it using two RELAX NG schemas. This sounds odd perhaps.

One schema is something like
   <oneOrMore>
           <choice> 
               <element name="child1"><text/></element>
               <element name="child2"><text/></element>
               ..
            </choice>
    </oneOrMore>

(There might be a simpler way to do this with wildcards rather than 
explicit naming.)

The other is
    <sequence>
         <optional>
               <element name="child1"><text/></element>
        </optional>
        <optional>
               <element name="child2"><text/></element>
        </optional>
               ...
    </sequence>

If you are using Schematron, just replace the first one by
   <rule context="parent" >
        <assert test="count(*) &gt; 0">
        The "parent" element should have at at least one child, for example
        child1, child2, ...
        </assert>
   </rule>

Cheers
Rick Jelliffe


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS