ZVON > References > Zvon Example Repository
Example repository: index | categories | search

All > Relax NG > Simplification - combine attribute > Test 190

Previous sample | Next sample

Author: James Clark
Origin: Testsuite for Relax NG


ElementsAttributes
elementname |
empty
grammar
startcombine |

ZVON comment: For each grammar element, all start elements with the same name are combined together. Here the combine attribute has value "choice" and thus the root element can be only "foo1", "foo2", or "foo3", but not "foo4".

Correct schema

<grammar xmlns:html="http://www.w3.org/TR/REC-html40" xmlns="http://relaxng.org/ns/structure/1.0" >
     <start combine="choice">
          <element name="foo1">
               <empty/>
          </element>
     </start>
     <start combine="choice">
          <element name="foo2">
               <empty/>
          </element>
     </start>
     <start>
          <element name="foo3">
               <empty/>
          </element>
     </start>
</grammar>


Valid document:
<foo1/>

Valid document:
<foo2/>

Valid document:
<foo3/>

Invalid document:
<foo4/>