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

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

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 "interleave", so the elements "foo1", "foo2", and "foo3" can be interleaved.

Correct schema

<grammar xmlns:html="http://www.w3.org/TR/REC-html40" xmlns="http://relaxng.org/ns/structure/1.0" >
     <start>
          <element name="foo">
               <ref name="x"/>
          </element>
     </start>
     <define name="x" combine="interleave">
          <element name="bar1">
               <empty/>
          </element>
     </define>
     <define name="x" combine="interleave">
          <element name="bar2">
               <empty/>
          </element>
     </define>
     <define name="x">
          <element name="bar3">
               <empty/>
          </element>
     </define>
</grammar>


Valid document:
<foo>
     <bar1/>
     <bar2/>
     <bar3/>
</foo>

Valid document:
<foo>
     <bar1/>
     <bar3/>
     <bar2/>
</foo>

Valid document:
<foo>
     <bar2/>
     <bar3/>
     <bar1/>
</foo>

Invalid document:
<foo>
     <bar2/>
     <bar3/>
     <bar1/>
     <bar2/>
</foo>