>> Note that
>>
>> <define name="foo" as="nameClass">
>>    <name>x</name>
>>    <name>y</name>
>> </define>
>>
>> would be equivalent to
>>
>> <define name="foo" as="nameClass">
>>   <choice>
>>     <name>x</name>
>>     <name>y</name>
>>   </choice>
>> </define>
>
> I wonder if that would be too confusing.

Two reasons to allow it:

- we already allow multiple child elements when defining a pattern

- we already allow multiple child name classes in an except with
semantics of choice

<anyName>
  <except>
   <name>foo</name>
   <name>bar</name>
   <name>baz</name>
 </except>
</anyName>

A reference to a name class is quite likely to be used in an except.

Conceptually, a name class is just a set of names, and the natural way
to define a set of names is to list them as children of the define.  I
would say that this:

<define name="myNames" as="nameClass">
   <name>foo</name>
   <name>bar</name>
   <name>baz</name>
</define>

<define name="other">
   <element>
      <anyName>
         <except>
            <ref name="myNames"/>
         </except>
       </anyName>
       <ref name="whatever"/>
   </element>
</define>

is more natural than forcing a <choice>:

<define name="myNames" as="nameClass">
  <choice>
     <name>foo</name>
     <name>bar</name>
     <name>baz</name>
  </choice>
</define>

especially given that you are already allowed to write:

<define name="other">
   <element>
      <anyName>
         <except>
            <name>foo</name>
            <name>bar</name>
            <name>baz</name>
         </except>
       </anyName>
       <ref name="whatever"/>
   </element>
</define>

James

Reply via email to