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

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

Previous sample | Next sample

Author: James Clark
Origin: Testsuite for Relax NG


ElementsAttributes
definecombine | name |
elementname |
empty
grammar
refname |
start

ZVON comment: For each grammar element, all define 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>
          <ref name="x"/>
     </start>
     <define name="x" combine="choice">
          <element name="foo1">
               <empty/>
          </element>
     </define>
     <define name="x" combine="choice">
          <element name="foo2">
               <empty/>
          </element>
     </define>
     <define name="x">
          <element name="foo3">
               <empty/>
          </element>
     </define>
</grammar>


Valid document:
<foo1/>

Valid document:
<foo2/>

Valid document:
<foo3/>

Invalid document:
<foo4/>