C. XHTML RELAX NG Module Implementations

Contents

This appendix is normative.

This appendix contains implementations of the modules defined in this specification. These module implementations can be used in other XHTML Family Document Types.

C.1. XHTML Module Implementations

This section contains the formal definition of each of the XHTML Abstract Modules as a RELAX NG module.

C.1.1. Attribute Collections

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Attribute Collections Module</x:h1>
  <div>
    <x:h2>Core Attributes Module</x:h2>
    <include href="xhtml-core-attrib-2.rng"/>
  </div>
  <div>
    <x:h2>Internationalization Attribute Module</x:h2>
    <include href="xhtml-i18n-attrib-2.rng"/>
  </div>
  <div>
    <x:h2>Bi-directional Text Collection</x:h2>
    <include href="xhtml-bidi-attrib-2.rng"/>
  </div>
  <div>
    <x:h2>Edit Attributes Module</x:h2>
    <include href="xhtml-edit-attrib-2.rng"/>
  </div>
  <div>
    <x:h2>Embedding Attributes Module</x:h2>
    <include href="xhtml-embed-attrib-2.rng"/>
  </div>
  <div>
    <x:h2>XForms Repeat Attribute Collection</x:h2>
    <include href="xforms-repeat-attrib.rng"/>
    <define name="xhtml.Common.attrib" combine="interleave">
      <ref name="xforms.Repeat.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>Hypertext Attributes Module</x:h2>
    <include href="xhtml-hypertext-attrib-2.rng"/>
  </div>
  <div>
    <x:h2>Image Map Attributes Module</x:h2>
    <include href="xhtml-imagemap-attrib-2.rng"/>
  </div>
  <div>
    <x:h2>Media Attribute Module</x:h2>
    <include href="xhtml-media-attrib-2.rng"/>
  </div>
  <div>
    <x:h2>Metainformation Attributes Module</x:h2>
    <include href="xhtml-meta-attrib-2.rng"/>
  </div>
  <div>
    <x:h2>Role Attribute Module</x:h2>
    <include href="xhtml-role-attrib-2.rng"/>
  </div>
  <div>
    <x:h2>Style Attribute Module</x:h2>
    <include href="xhtml-inlstyle-2.rng"/>
  </div>
  <define name="xhtml.Common.extra.attrib">
    <empty/>
  </define>
  <define name="xhtml.Common.attrib">
    <ref name="xhtml.Common.extra.attrib"/>
  </define>
</grammar>

C.1.2. Document

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Document Module</x:h1>
  <start>
    <ref name="xhtml.html"/>
  </start>
  <div>
    <x:h2>The html element</x:h2>
    <define name="xhtml.html">
      <element name="html">
        <ref name="xhtml.html.attlist"/>
        <ref name="xhtml.head"/>
        <ref name="xhtml.body"/>
      </element>
    </define>
    <define name="xhtml.html.attlist">
      <ref name="xhtml.Common.attrib"/>
      <optional>
        <ref name="xhtml.version.attrib"/>
      </optional>
    </define>
    <define name="xhtml.version.attrib">      
        <attribute name="version">
          <ref name="CDATA.datatype"/>
        </attribute>     
    </define>
  </div>
  <div>
    <x:h2>The head element</x:h2>
    <define name="xhtml.head">
      <element name="head">
        <ref name="xhtml.head.attlist"/>
        <ref name="xhtml.head.content"/>
      </element>
    </define>
    <define name="xhtml.head.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.head.content">
      <ref name="xhtml.title"/>
      <zeroOrMore>
        <choice>
          <ref name="xhtml.head.misc"/>
        </choice>
      </zeroOrMore>
    </define>
    <define name="xhtml.head.misc">
      <notAllowed/>
    </define>
  </div>
  <div>
    <x:h2>The title element</x:h2>
    <define name="xhtml.title">
      <element name="title">
        <ref name="xhtml.title.attlist"/>
        <ref name="xhtml.title.content"/>        
      </element>
    </define>
    <define name="xhtml.title.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.title.content">    
      <ref name="xhtml.Text.model"/>
    </define> 
    <define name="xhtml.Text.class" combine="choice">
      <ref name="xhtml.title"/>
    </define>
  </div>
  <div>
    <x:h2>The body element</x:h2>
    <define name="xhtml.body">
      <element name="body">
        <ref name="xhtml.body.attlist"/>
        <ref name="xhtml.body.content"/>        
      </element>
    </define>
    <define name="xhtml.body.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.body.content">    
      <ref name="xhtml.Structural.model"/>
    </define>
  </div>
</grammar>

C.1.3. Structural

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Structural Module</x:h1>
  <div>
    <x:h2>The address element</x:h2>
    <define name="xhtml.address">
      <element name="address">
        <ref name="xhtml.address.attlist"/>
        <ref name="xhtml.address.content"/>
      </element>
    </define>
    <define name="xhtml.address.attlist">
      <ref name="xhtml.Structural.attrib"/>
    </define>
    <define name="xhtml.address.content">
      <ref name="xhtml.Text.model"/>
    </define>      
  </div>
  <div>
    <x:h2>The blockcode element</x:h2>
    <define name="xhtml.blockcode">
      <element name="blockcode">
        <ref name="xhtml.blockcode.attlist"/>
        <ref name="xhtml.blockcode.content"/>
      </element>
    </define>
    <define name="xhtml.blockcode.attlist">
      <ref name="xhtml.Structural.attrib"/>
    </define>
    <define name="xhtml.blockcode.content">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="xhtml.Text.class"/>
          <ref name="xhtml.Heading.class"/>
          <ref name="xhtml.Structural.class"/>
          <ref name="xhtml.List.class"/>
          <ref name="xhtml.Misc.class"/>
        </choice>
      </zeroOrMore>
    </define>
  </div>
  <div>
    <x:h2>The blockquote element</x:h2>
    <define name="xhtml.blockquote">
      <element name="blockquote">
        <ref name="xhtml.blockquote.attlist"/>
        <ref name="xhtml.blockquote.content"/>
      </element>
    </define>
    <define name="xhtml.blockquote.attlist">
      <ref name="xhtml.Structural.attrib"/>
    </define>
    <define name="xhtml.blockquote.content">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="xhtml.Text.class"/>
          <ref name="xhtml.Heading.class"/>
          <ref name="xhtml.Structural.class"/>
          <ref name="xhtml.List.class"/>
          <ref name="xhtml.Misc.class"/>
        </choice>
      </zeroOrMore>
    </define>
  </div>
  <div>
    <x:h2>The div element</x:h2>
    <define name="xhtml.div">
      <element name="div">
        <ref name="xhtml.div.attlist"/>
        <ref name="xhtml.div.content"/>
      </element>
    </define>
    <define name="xhtml.div.attlist">
      <ref name="xhtml.Structural.attrib"/>
    </define>
    <define name="xhtml.div.content">
      <ref name="xhtml.Flow.model"/>
    </define>  
  </div>
  <div>
    <x:h2>The heading element</x:h2>
    <define name="xhtml.h">
      <element name="h">
        <ref name="xhtml.h.attlist"/>
        <ref name="xhtml.h.content"/>
      </element>
    </define>
    <define name="xhtml.h.attlist">
      <ref name="xhtml.Structural.attrib"/>
    </define>
    <define name="xhtml.h.content">
      <ref name="xhtml.Text.model"/>
    </define>
  </div>
  <div>
    <x:h2>The p element</x:h2>
    <define name="xhtml.p">
      <element name="p">
        <ref name="xhtml.p.attlist"/>
        <ref name="xhtml.p.content"/>
      </element>
    </define>
    <define name="xhtml.p.attlist">
      <ref name="xhtml.Structural.attrib"/>
    </define>
    <define name="xhtml.p.content">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="xhtml.Text.class"/>
          <ref name="xhtml.List.class"/>
          <ref name="xhtml.blockcode"/>
          <ref name="xhtml.blockquote"/>
          <ref name="xhtml.pre"/>
          <ref name="xhtml.table"/>
          <ref name="xhtml.Misc.class"/>
        </choice>
      </zeroOrMore>
    </define>
  </div>
  <div>
    <x:h2>The pre element</x:h2>
    <define name="xhtml.pre">
      <element name="pre">
        <ref name="xhtml.pre.attlist"/>
        <ref name="xhtml.pre.content"/>
      </element>
    </define>
    <define name="xhtml.pre.attlist">
      <ref name="xhtml.Structural.attrib"/>
    </define>
    <define name="xhtml.pre.content">    
      <ref name="xhtml.Text.model"/>
    </define>  
  </div>
  <div>
    <x:h2>The section element</x:h2>
    <define name="xhtml.section">
      <element name="section">
        <ref name="xhtml.section.attlist"/>
        <ref name="xhtml.section.content"/>
      </element>
    </define>
    <define name="xhtml.section.attlist">
      <ref name="xhtml.Structural.attrib"/>
    </define>
    <define name="xhtml.section.content">
      <ref name="xhtml.Flow.model"/>
    </define>    
    <!-- This pattern is not referenced by the default
      XHTML2 content model, but provided for the convenience 
      of language designers -->      
    <define name="xhtml.section.strict.model">  	
      <zeroOrMore>
        <choice>
          <ref name="xhtml.section.strict.prehead.extra"/>
        </choice>
      </zeroOrMore>	    
      <ref name="xhtml.Heading.class" />
	  <zeroOrMore>
        <choice>
          <ref name="xhtml.Structural.class"/>
        </choice>	
      </zeroOrMore>
    </define>
    <define name="xhtml.section.strict.prehead.extra">
      <empty/>
    </define>
  </div>
  <div>
    <x:h2>The separator element</x:h2>
    <define name="xhtml.separator">
      <element name="separator">
        <ref name="xhtml.separator.attlist"/>
        <empty/>        
      </element>
    </define>
    <define name="xhtml.separator.attlist">
      <ref name="xhtml.Structural.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>Content Model</x:h2>
    <define name="xhtml.Heading.class">
      <choice>
        <ref name="xhtml.h"/>
      </choice>
    </define>
    <define name="xhtml.Structural.nosection.class">
      <choice>
        <ref name="xhtml.address"/>
        <ref name="xhtml.blockcode"/>
        <ref name="xhtml.blockquote"/>
        <ref name="xhtml.div"/>
        <ref name="xhtml.p"/>
        <ref name="xhtml.pre"/>
        <ref name="xhtml.separator"/>
      </choice>
    </define>
    <define name="xhtml.Structural.class">
      <choice>
    	<ref name="xhtml.Structural.nosection.class" />
        <ref name="xhtml.section"/>        
      </choice>
    </define>
    <define name="xhtml.Structural.mix">
      <zeroOrMore>
        <choice>
          <ref name="xhtml.Heading.class"/>
          <ref name="xhtml.Structural.class"/>
          <ref name="xhtml.List.class"/>
          <ref name="xhtml.Misc.class"/>
        </choice>
      </zeroOrMore>
    </define>
    <define name="xhtml.Structural.model">
      <oneOrMore>
        <ref name="xhtml.Structural.mix"/>
      </oneOrMore>
    </define>
    <define name="xhtml.Flow.model">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="xhtml.Heading.class"/>
          <ref name="xhtml.Structural.class"/>
          <ref name="xhtml.List.class"/>
          <ref name="xhtml.Text.class"/>
          <ref name="xhtml.Misc.class"/>
        </choice>
      </zeroOrMore>
    </define>
    <define name="xhtml.Structural.attrib" combine="interleave">
      <ref name="xhtml.Common.attrib" />
    </define>
  </div>
</grammar>

C.1.4. Text

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Text Module</x:h1>
  <div>
    <x:h2>The abbr element</x:h2>
    <define name="xhtml.abbr">
      <element name="abbr">
        <ref name="xhtml.abbr.attlist"/>
        <ref name="xhtml.abbr.content"/>
      </element>
    </define>
    <define name="xhtml.abbr.attlist">
      <ref name="xhtml.Text.attrib"/>
      <optional>
        <attribute name="full">
          <ref name="URI.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="xhtml.abbr.content">    
      <ref name="xhtml.Text.model"/>
    </define>  
  </div>
  <div>
    <x:h2>The cite element</x:h2>
    <define name="xhtml.cite">
      <element name="cite">
        <ref name="xhtml.cite.attlist"/>
        <ref name="xhtml.cite.content"/>
      </element>
    </define>
    <define name="xhtml.cite.attlist">
      <ref name="xhtml.Text.attrib"/>
    </define>
    <define name="xhtml.cite.content">
        <ref name="xhtml.Text.model"/>    
    </define>
  </div>
  <div>
    <x:h2>The code element</x:h2>
    <define name="xhtml.code">
      <element name="code">
        <ref name="xhtml.code.attlist"/>
        <ref name="xhtml.code.content"/>        
      </element>
    </define>
    <define name="xhtml.code.attlist">
      <ref name="xhtml.Text.attrib"/>
    </define>
    <define name="xhtml.code.content">
        <ref name="xhtml.Text.model"/>    
    </define>
  </div>
  <div>
    <x:h2>The dfn element</x:h2>
    <define name="xhtml.dfn">
      <element name="dfn">
        <ref name="xhtml.dfn.attlist"/>
        <ref name="xhtml.dfn.content"/>        
      </element>
    </define>
    <define name="xhtml.dfn.attlist">
      <ref name="xhtml.Text.attrib"/>
    </define>
    <define name="xhtml.dfn.content">    
      <ref name="xhtml.Text.model"/>
    </define>  
  </div>
  <div>
    <x:h2>The em element</x:h2>
    <define name="xhtml.em">
      <element name="em">
        <ref name="xhtml.em.attlist"/>
        <ref name="xhtml.em.content"/>        
      </element>
    </define>
    <define name="xhtml.em.attlist">
      <ref name="xhtml.Text.attrib"/>
    </define>
    <define name="xhtml.em.content">
      <ref name="xhtml.Text.model"/>    
    </define>
  </div>
  <div>
    <x:h2>The kbd element</x:h2>
    <define name="xhtml.kbd">
      <element name="kbd">
        <ref name="xhtml.kbd.attlist"/>
        <ref name="xhtml.kbd.content"/>        
      </element>
    </define>
    <define name="xhtml.kbd.attlist">
      <ref name="xhtml.Text.attrib"/>
    </define>
    <define name="xhtml.kbd.content">
      <ref name="xhtml.Text.model"/>
    </define>
  </div>
  <div>
    <x:h2>The l element</x:h2>
    <define name="xhtml.l">
      <element name="l">
        <ref name="xhtml.l.attlist"/>
        <ref name="xhtml.l.content"/>        
      </element>
    </define>
    <define name="xhtml.l.attlist">
      <ref name="xhtml.Text.attrib"/>
    </define>
    <define name="xhtml.l.content">
      <ref name="xhtml.Text.model"/>
    </define>
  </div>
  <div>
    <x:h2>The quote element</x:h2>
    <define name="xhtml.quote">
      <element name="q">
        <ref name="xhtml.quote.attlist"/>
        <ref name="xhtml.quote.content"/>        
      </element>
    </define>
    <define name="xhtml.quote.attlist">
      <ref name="xhtml.Text.attrib"/>
    </define>
    <define name="xhtml.quote.content">    
      <ref name="xhtml.Text.model"/>
    </define>  
  </div>
  <div>
    <x:h2>The samp element</x:h2>
    <define name="xhtml.samp">
      <element name="samp">
        <ref name="xhtml.samp.attlist"/>
        <ref name="xhtml.samp.content"/>        
      </element>
    </define>
    <define name="xhtml.samp.attlist">
      <ref name="xhtml.Text.attrib"/>
    </define>
    <define name="xhtml.samp.content">    
      <ref name="xhtml.Text.model"/>
    </define>  
  </div>
  <div>
    <x:h2>The span element</x:h2>
    <define name="xhtml.span">
      <element name="span">
        <ref name="xhtml.span.attlist"/>
        <ref name="xhtml.span.content"/>        
      </element>
    </define>
    <define name="xhtml.span.attlist">
      <ref name="xhtml.Text.attrib"/>
    </define>
    <define name="xhtml.span.content">    
      <ref name="xhtml.Text.model"/>
    </define>  
  </div>
  <div>
    <x:h2>The strong element</x:h2>
    <define name="xhtml.strong">
      <element name="strong">
        <ref name="xhtml.strong.attlist"/>
        <ref name="xhtml.strong.content"/>        
      </element>
    </define>
    <define name="xhtml.strong.attlist">
      <ref name="xhtml.Text.attrib"/>
    </define>
    <define name="xhtml.strong.content">    
      <ref name="xhtml.Text.model"/>
    </define>  
  </div>
  <div>
    <x:h2>The sub element</x:h2>
    <define name="xhtml.sub">
      <element name="sub">
        <ref name="xhtml.sub.attlist"/>
        <ref name="xhtml.sub.content"/>
      </element>
    </define>
    <define name="xhtml.sub.attlist">
      <ref name="xhtml.Text.attrib"/>
    </define>
    <define name="xhtml.sub.content">
      <ref name="xhtml.Text.model"/>
    </define>  
  </div>
  <div>
    <x:h2>The sup element</x:h2>
    <define name="xhtml.sup">
      <element name="sup">
        <ref name="xhtml.sup.attlist"/>
        <ref name="xhtml.sup.content"/>        
      </element>
    </define>
    <define name="xhtml.sup.attlist">
      <ref name="xhtml.Text.attrib"/>
    </define>
    <define name="xhtml.sup.content">
      <ref name="xhtml.Text.model"/>
    </define>  
  </div>
  <div>
    <x:h2>The var element</x:h2>
    <define name="xhtml.var">
      <element name="var">
        <ref name="xhtml.var.attlist"/>
        <ref name="xhtml.var.content"/>        
      </element>
    </define>
    <define name="xhtml.var.attlist">
      <ref name="xhtml.Text.attrib"/>
    </define>
    <define name="xhtml.var.content">
      <ref name="xhtml.Text.model"/>
    </define>  
  </div>
  <div>
    <x:p>these can occur at Structural or Text level</x:p>
    <define name="xhtml.Misc.class">
      <empty/>
    </define>
  </div>
  <div>
    <x:h2>Content Model</x:h2>
    <define name="xhtml.Text.class">
      <choice>
        <ref name="xhtml.abbr"/>
        <ref name="xhtml.cite"/>
        <ref name="xhtml.code"/>
        <ref name="xhtml.dfn"/>
        <ref name="xhtml.em"/>
        <ref name="xhtml.kbd"/>
        <ref name="xhtml.l"/>
        <ref name="xhtml.quote"/>
        <ref name="xhtml.samp"/>
        <ref name="xhtml.span"/>
        <ref name="xhtml.strong"/>
        <ref name="xhtml.sub"/>
        <ref name="xhtml.sup"/>
        <ref name="xhtml.var"/>
      </choice>
    </define>
    <define name="xhtml.Text.model">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="xhtml.Text.class"/>
          <ref name="xhtml.Misc.class"/>
        </choice>
      </zeroOrMore>
    </define>
    <define name="xhtml.Text.attrib" combine="interleave">
      <ref name="xhtml.Common.attrib"/>
    </define>
  </div>
</grammar>

C.1.5. Hypertext

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Hypertext Module</x:h1>
  <div>
    <x:h2>The a element</x:h2>
    <define name="xhtml.a">
      <element name="a">
        <ref name="xhtml.a.attlist"/>
        <ref name="xhtml.a.content"/>        
      </element>
    </define>
    <define name="xhtml.a.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.a.content">
      <ref name="xhtml.Text.model"/>
    </define>
  </div>
  <define name="xhtml.Text.class" combine="choice">
    <ref name="xhtml.a"/>
  </define>
</grammar>

C.1.6. List

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>List Module</x:h1>
  <div>
    <x:h2>The dl element</x:h2>
    <define name="xhtml.dl">
      <element name="dl">
        <ref name="xhtml.dl.attlist"/>
        <ref name="xhtml.dl.content"/>
      </element>
    </define>
    <define name="xhtml.dl.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.dl.content">    
      <optional>
        <ref name="xhtml.title"/>
      </optional>
      <optional>
        <ref name="xhtml.caption"/>
      </optional>
      <choice>
        <oneOrMore>
          <choice>
            <ref name="xhtml.dt"/>
            <ref name="xhtml.dd"/>
          </choice>
        </oneOrMore>
        <oneOrMore>
          <ref name="xhtml.di"/>
        </oneOrMore>
      </choice>
    </define>   
    <!-- This pattern is not referenced by the default
    XHTML2 content model, but provided for the convenience 
    of language designers -->
    <define name="xhtml.dl.content.di.required">    
      <optional>
        <ref name="xhtml.caption"/>
      </optional>      
      <oneOrMore>
        <ref name="xhtml.di"/>
      </oneOrMore>      
    </define>
  </div>
  <div>
    <x:h2>The di element</x:h2>
    <define name="xhtml.di">
      <element name="di">
        <ref name="xhtml.di.attlist"/>
        <ref name="xhtml.di.content"/>
      </element>
    </define>
    <define name="xhtml.di.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.di.content">    
      <oneOrMore>
        <ref name="xhtml.dt"/>
      </oneOrMore>
      <zeroOrMore>
        <ref name="xhtml.dd"/>
      </zeroOrMore>
    </define>        
  </div>
  <div>
    <x:h2>The dt element</x:h2>
    <define name="xhtml.dt">
      <element name="dt">
        <ref name="xhtml.dt.attlist"/>
        <ref name="xhtml.dt.content"/>
      </element>
    </define>
    <define name="xhtml.dt.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.dt.content">
      <ref name="xhtml.Text.model"/>
    </define>    
  </div>
  <div>
    <x:h2>The dd element</x:h2>
    <define name="xhtml.dd">
      <element name="dd">
        <ref name="xhtml.dd.attlist"/>
        <ref name="xhtml.dd.content"/>
      </element>
    </define>
    <define name="xhtml.dd.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.dd.content">    
      <ref name="xhtml.Flow.model"/>
    </define>  
  </div>
  <div>
    <x:h2>The ol element</x:h2>
    <define name="xhtml.ol">
      <element name="ol">
        <ref name="xhtml.ol.attlist"/>
        <ref name="xhtml.ol.content"/>
      </element>
    </define>
    <define name="xhtml.ol.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.ol.content">    
      <optional>
        <ref name="xhtml.title"/>
      </optional>    
      <optional>
        <ref name="xhtml.caption"/>
      </optional>
      <oneOrMore>
        <ref name="xhtml.li-in-ol"/>
      </oneOrMore>
    </define>  
  </div>
  <div>
    <x:h2>The ul element</x:h2>
    <define name="xhtml.ul">
      <element name="ul">
        <ref name="xhtml.ul.attlist"/>
        <ref name="xhtml.ul.content"/>
      </element>
    </define>
    <define name="xhtml.ul.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.ul.content">
      <optional>
        <ref name="xhtml.title"/>
      </optional>        
      <optional>
        <ref name="xhtml.caption"/>
      </optional>
      <oneOrMore>
        <ref name="xhtml.li"/>
      </oneOrMore>    
    </define>
  </div>
  <div>
    <x:h2>The li element</x:h2>
    <define name="xhtml.li">
      <element name="li">
        <ref name="xhtml.li.attlist"/>
        <ref name="xhtml.li.content"/>
      </element>
    </define>  
    <define name="xhtml.li.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.li.content">
        <ref name="xhtml.Flow.model"/>    
    </define>
    <define name="xhtml.li-in-ol">
      <element name="li">
        <ref name="xhtml.li-in-ol.attlist"/>
        <ref name="xhtml.li.content"/>
      </element>
    </define>  
    <define name="xhtml.li-in-ol.attlist">
      <ref name="xhtml.li.attlist"/>
      <ref name="xhtml.li-in-ol.value.attrib"/>
    </define>
    <define name="xhtml.li-in-ol.value.attrib">
      <optional>
        <attribute name="value">
          <ref name="Number.datatype"/>
        </attribute>
      </optional>
    </define>
  </div>
  <div>
    <x:h2>List Content Set</x:h2>
    <define name="xhtml.List.class">
      <choice>
        <ref name="xhtml.dl"/>
        <ref name="xhtml.ol"/>
        <ref name="xhtml.ul"/>
      </choice>
    </define>
  </div>
</grammar>

C.1.7. Core Attributes

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"         
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Core Attributes Module</x:h1>
  <div>
    <x:h2>Core Attribute Collection</x:h2>
    <define name="xhtml.class.attrib">
      <attribute name="class">
        <ref name="NMTOKENS.datatype"/>
      </attribute>
    </define>
    <define name="xhtml.id.attrib">
      <choice>
        <ref name="id.attrib"/>
        <ref name="xmlid.attrib"/>         
      </choice>          
    </define>
    <define name="xhtml.layout.attrib">      
      <!-- a:defaultValue="irrelevant" -->
      <attribute name="layout">
        <choice>
          <value>irrelevant</value>  
          <value>relevant</value>  
        </choice>
      </attribute>      
    </define>
    <define name="xhtml.title.attrib">
       <attribute name="title">
        <ref name="Text.datatype"/>
       </attribute>
    </define>
    <define name="xhtml.Core.attrib">
      <optional>
        <ref name="xhtml.id.attrib"/>
      </optional>
      <optional>
        <ref name="xhtml.class.attrib"/>
      </optional>
      <optional>
        <ref name="xhtml.layout.attrib"/>
      </optional>
      <optional>
        <ref name="xhtml.title.attrib"/>
      </optional>
    </define>
  </div>
  <define name="xhtml.Common.attrib" combine="interleave">
    <ref name="xhtml.Core.attrib"/>
  </define>
  <define name="id.attrib">
    <attribute name="id">
      <ref name="ID.datatype"/>
    </attribute>       
  </define>
  <define name="xmlid.attrib">
    <attribute name="xml:id">
      <ref name="ID.datatype"/>
    </attribute>    
  </define>
</grammar>

C.1.8. Hypertext Attributes

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Hypertext Attributes Module</x:h1>
  <div>
    <x:h2>Hypertext Attributes Collection</x:h2>
    <define name="xhtml.cite.attrib">      
      <attribute name="cite">
        <ref name="URI.datatype"/>
      </attribute>      
    </define>
    <define name="xhtml.href.attrib">      
      <attribute name="href">
        <ref name="URI.datatype"/>
      </attribute>
    </define>
    <define name="xhtml.hreflang.attrib">      
      <attribute name="hreflang">
        <ref name="LanguageCodes.datatype"/>
      </attribute>
    </define>
    <define name="xhtml.hrefmedia.attrib">
      <attribute name="hrefmedia">
        <ref name="MediaDesc.datatype"/>
      </attribute>
    </define>
    <define name="xhtml.hreftype.attrib">      
      <attribute name="hreftype">
        <ref name="ContentTypes.datatype"/>
      </attribute>      
    </define>
    <define name="xhtml.nextfocus.attrib">      
      <attribute name="nextfocus">
        <ref name="IDREF.datatype"/>
      </attribute>      
    </define>
    <define name="xhtml.prevfocus.attrib">
      <attribute name="prevfocus">
        <ref name="IDREF.datatype"/>
      </attribute>
    </define>
    <define name="xhtml.target.attrib">      
      <attribute name="target">
        <ref name="HrefTarget.datatype"/>
      </attribute>
    </define>
    <define name="xml.base.attrib">      
      <attribute name="xml:base">
        <ref name="URI.datatype"/>
      </attribute>
    </define>
    <define name="xhtml.Hypertext.attrib">
      <optional>
        <ref name="xhtml.cite.attrib"/>
      </optional>
      <optional>
        <ref name="xhtml.href.attrib"/>
      </optional>
      <optional>
        <ref name="xhtml.hreflang.attrib"/>
      </optional>
      <optional>
        <ref name="xhtml.hrefmedia.attrib"/>
      </optional>
      <optional>
        <ref name="xhtml.hreftype.attrib"/>
      </optional>
      <optional>
        <ref name="xhtml.nextfocus.attrib"/>
      </optional>
      <optional>
        <ref name="xhtml.prevfocus.attrib"/>
      </optional>
      <optional>
        <ref name="xhtml.target.attrib"/>
      </optional>
      <optional>
        <ref name="xml.base.attrib"/>
      </optional>
    </define>
  </div>
  <define name="xhtml.Common.attrib" combine="interleave">
    <ref name="xhtml.Hypertext.attrib"/>
  </define>
</grammar>

C.1.9. I18N Attributes

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>I18N Attribute Module</x:h1>
  <div>
    <x:h2>I18N Attribute Collection</x:h2>
    <define name="xml.lang.attrib">
      <attribute name="xml:lang">
        <ref name="LanguageCode.datatype"/>
      </attribute>
    </define>
    <define name="xhtml.I18n.attrib">
      <optional>
        <ref name="xml.lang.attrib"/>
      </optional>  
    </define>
  </div>
  <define name="xhtml.Common.attrib" combine="interleave">
    <ref name="xhtml.I18n.attrib"/>
  </define>
</grammar>

C.1.10. Access

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Access Module</x:h1>
  <div>
    <x:h2>The access element</x:h2>
    <define name="xhtml.access">
      <element name="access">
        <empty />
        <ref name="xhtmlAccess.attlist"/>
      </element>
    </define>
    <define name="xhtmlAccess.attlist">
      <ref name="xhtml.Common.attrib"/>
      <ref name="xhtmlAccess.activate.attrib"/>
      <ref name="xhtmlAccess.key.attrib"/>
      <ref name="xhtmlAccess.order.attrib"/>
      <ref name="xhtmlAccess.targetid.attrib"/>
      <ref name="xhtmlAccess.targetrole.attrib"/>
    </define>
    <define name="xhtmlAccess.activate.attrib">
      <optional>
        <!-- a:defaultValue="false" -->
        <attribute name="activate">
          <choice>
            <value>true</value>
            <value>false</value>
          </choice>
        </attribute>
      </optional>
    </define>  
    <define name="xhtmlAccess.key.attrib">    
      <optional>
        <attribute name="key">
          <ref name="Characters.datatype"/>
        </attribute>
      </optional>
    </define>      
    <define name="xhtmlAccess.order.attrib">    
      <optional>
        <!-- a:defaultValue="document" -->
        <attribute name="order">
          <choice>
            <value>document</value>
            <value>list</value>
          </choice>
        </attribute>
      </optional>    
    </define>
    <define name="xhtmlAccess.targetid.attrib">    
      <optional>
        <attribute name="targetid">
          <ref name="IDREF.datatype"/>
        </attribute>
      </optional>    
    </define>     
    <define name="xhtmlAccess.targetrole.attrib">    
      <optional>
        <attribute name="targetrole">
          <ref name="CURIEs.datatype"/>
        </attribute>
      </optional>
    </define>      
  </div>
  <define name="xhtml.head.misc" combine="choice">
    <ref name="xhtml.access"/>
  </define>
</grammar>

C.1.11. Bi-directional Text Attribute

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"         
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Bi-directional Text Attribute Module</x:h1>
  <div>
    <x:h2>Bi-directional Text Collection</x:h2>
    <define name="xhtml.dir.attrib">
      <optional>
        <!-- a:defaultValue="ltr" -->
        <attribute name="dir">
          <choice>
            <value>ltr</value>
            <value>rtl</value>
            <value>lro</value>
            <value>rlo</value>
          </choice>
        </attribute>
      </optional>
    </define>
    <define name="xhtml.Bidi.attrib">
      <ref name="xhtml.dir.attrib"/>
    </define>
  </div>
  <define name="xhtml.Common.attrib" combine="interleave">
    <ref name="xhtml.Bidi.attrib"/>
  </define>
</grammar>

C.1.12. Edit Attributes

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Edit Attribute Module</x:h1>
  <div>
    <x:h2>Edit Collection</x:h2>
    <define name="xhtml.edit.attrib">
        <attribute name="edit">
          <choice>
            <value>inserted</value>
            <value>deleted</value>
            <value>changed</value>
            <value>moved</value>
          </choice>
        </attribute>
    </define>
    <define name="xhtml.datetime.attrib">      
        <attribute name="datetime">
          <ref name="Datetime.datatype"/>
        </attribute>
    </define>
    <define name="xhtml.Edit.attrib">
      <optional>
        <ref name="xhtml.edit.attrib"/>
      </optional>
      <optional>  
        <ref name="xhtml.datetime.attrib"/>
      </optional>  
    </define>
  </div>
  <define name="xhtml.Common.attrib" combine="interleave">
    <ref name="xhtml.Edit.attrib"/>
  </define>
</grammar>

C.1.13. Embedding Attributes

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Embedding Attributes Module</x:h1>
  <div>
    <x:h2>Embedding Attributes Collection</x:h2>
    <define name="xhtml.src.attrib">      
      <attribute name="src">
        <ref name="URI.datatype"/>
      </attribute>      
    </define>
    <define name="xhtml.encoding.attrib">      
      <attribute name="encoding">
        <ref name="Encodings.datatype"/>
      </attribute>
    </define>
    <define name="xhtml.srctype.attrib">      
      <attribute name="srctype">
        <ref name="ContentTypes.datatype"/>
      </attribute>      
    </define>
    <define name="xhtml.Embedding.attrib">
      <optional>
        <ref name="xhtml.src.attrib"/>
      </optional>
      <optional>  
        <ref name="xhtml.encoding.attrib"/>
      </optional>
      <optional>  
        <ref name="xhtml.srctype.attrib"/>
      </optional>  
    </define>
  </div>
  <define name="xhtml.Common.attrib" combine="interleave">
    <ref name="xhtml.Embedding.attrib"/>
  </define>
</grammar>

C.1.14. Image

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Image Module</x:h1>
  <div>
    <x:h2>The img element</x:h2>
    <define name="xhtml.img">
      <element name="img">
        <ref name="xhtml.img.attlist"/>
        <ref name="xhtml.img.content"/>        
      </element>
    </define>
    <define name="xhtml.img.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.img.content">
      <ref name="xhtml.Text.model"/>    
    </define>
  </div>
  <define name="xhtml.Text.class" combine="choice">
    <ref name="xhtml.img"/>
  </define>
</grammar>

C.1.15. Image Map Attributes

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Image Map Attributes Module</x:h1>
  <div>
    <x:h2>Image Map Attributes Collection</x:h2>
    <define name="xhtml.usemap.attrib">
      <optional>
        <attribute name="usemap">
          <ref name="URI.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="xhtml.ismap.attrib">
      <optional>
        <attribute name="ismap">
          <value>ismap</value>
        </attribute>
      </optional>
    </define>
    <define name="xhtml.shape.attrib">
      <optional>
        <attribute name="shape">
          <ref name="Shape.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="xhtml.coords.attrib">
      <optional>
        <attribute name="coords">
          <ref name="Coordinates.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="xhtml.Map.attrib">
      <ref name="xhtml.usemap.attrib"/>
      <ref name="xhtml.ismap.attrib"/>
      <ref name="xhtml.shape.attrib"/>
      <ref name="xhtml.coords.attrib"/>
    </define>
  </div>
  <define name="xhtml.Common.attrib" combine="interleave">
    <ref name="xhtml.Map.attrib"/>
  </define>
</grammar>

C.1.16. Media Attribute

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"         
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Media Attribute Module</x:h1>
  <define name="xhtml.media.attrib">
    <optional>
      <!-- a:defaultValue="all" -->
      <attribute name="media">
        <ref name="MediaDesc.datatype"/>
      </attribute>
    </optional>
  </define>
  <define name="xhtml.Common.attrib" combine="interleave">
    <ref name="xhtml.media.attrib"/>
  </define>
</grammar>

C.1.17. Metainformation Attributes

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
<x:h1>Metainformation Attributes Module</x:h1>
  <div>
    <x:h2>Metadata Attribute Collection</x:h2>
    <define name="rdfa.about.attrib">
      <optional>
        <attribute name="about">
          <ref name="URIorSafeCURIE.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="rdfa.content.attrib">
      <optional>
        <attribute name="content">
          <ref name="CDATA.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="rdfa.datatype.attrib">
      <optional>
        <attribute name="datatype">
          <ref name="CURIE.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="rdfa.typeof.attrib">
      <optional>
        <attribute name="typeof">
          <ref name="CURIEs.datatype"/>
        </attribute>
      </optional>
    </define>    
    <define name="rdfa.property.attrib">
      <optional>
        <!-- a:defaultValue="reference" -->
        <attribute name="property">
          <ref name="CURIEs.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="rdfa.rel.attrib">
      <optional>
        <attribute name="rel">
          <ref name="CURIEs.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="rdfa.resource.attrib">
      <optional>
        <attribute name="resource">
          <ref name="URIorSafeCURIE.datatype"/>
        </attribute>
      </optional>
    </define>    
    <define name="rdfa.rev.attrib">
      <optional>
        <attribute name="rev">
          <ref name="CURIEs.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="rdfa.Metadata.attrib">
      <ref name="rdfa.about.attrib"/>
      <ref name="rdfa.content.attrib"/>
      <ref name="rdfa.datatype.attrib"/>
      <ref name="rdfa.typeof.attrib"/>
      <ref name="rdfa.property.attrib"/>
      <ref name="rdfa.rel.attrib"/>
      <ref name="rdfa.resource.attrib"/>
      <ref name="rdfa.rev.attrib"/>
    </define>
  </div>
  <define name="xhtml.Common.attrib" combine="interleave">
    <ref name="rdfa.Metadata.attrib"/>
  </define>
</grammar>

C.1.18. Metainformation

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Metainformation Module</x:h1>
  <div>
    <x:h2>The link element</x:h2>
    <define name="xhtml.link">
      <element name="link">
        <ref name="xhtml.link.attlist"/>
        <ref name="xhtml.link.content"/>
      </element>
    </define>
    <define name="xhtml.link.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.link.content">
      <zeroOrMore>
        <choice>
          <ref name="xhtml.link"/>
          <ref name="xhtml.meta"/>
        </choice>
      </zeroOrMore>
    </define>
  </div>
  <define name="xhtml.head.misc" combine="choice">
    <ref name="xhtml.link"/>
  </define>
  <define name="xhtml.Misc.class" combine="choice">
    <ref name="xhtml.link"/>
  </define>
  <div>
    <x:h2>The meta element</x:h2>
    <define name="xhtml.meta">
      <element name="meta">
        <ref name="xhtml.meta.attlist"/>
        <ref name="xhtml.meta.content"/>
      </element>
    </define>
    <define name="xhtml.meta.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.meta.content">
        <ref name="xhtml.Text.model"/>    
    </define>
  </div>
  <define name="xhtml.head.misc" combine="choice">
    <ref name="xhtml.meta"/>
  </define>
  <define name="xhtml.Misc.class" combine="choice">
    <ref name="xhtml.meta"/>
  </define>
</grammar>

C.1.19. Object

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Object Module</x:h1>
  <x:p>Note. Also include the Caption Module when this module is used.</x:p>
  <div>
    <x:h2>The object element</x:h2>
    <define name="xhtml.object">
      <element name="object">
        <ref name="xhtml.object.attlist"/>
        <ref name="xhtml.object.content"/>        
      </element>
    </define>
    <define name="xhtml.object.attlist">
      <ref name="xhtml.Common.attrib"/>
      <optional>
        <attribute name="archive">
          <ref name="URIs.datatype"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="content-length">
          <ref name="Number.datatype"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="declare">
          <value>declare</value>
        </attribute>
      </optional>
    </define>
    <define name="xhtml.object.content">        
      <optional>
        <ref name="xhtml.caption"/>
      </optional>
      <optional>
        <ref name="xhtml.standby"/>
      </optional>
      <zeroOrMore>
        <ref name="xhtml.param"/>
      </zeroOrMore>
      <ref name="xhtml.Flow.model"/>
    </define>
  </div>
  <div>
    <x:h2>The standby element</x:h2>
    <define name="xhtml.standby">
      <element name="standby">
        <ref name="xhtml.standby.attlist"/>
        <ref name="xhtml.standby.model"/>
      </element>
    </define>
    <define name="xhtml.standby.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.standby.model">
        <ref name="xhtml.Text.model"/>    
    </define>
  </div>
  <define name="xhtml.Text.class" combine="choice">
    <ref name="xhtml.object"/>
  </define>
</grammar>

C.1.20. Style Attribute

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Style Attribute Module</x:h1>
  <define name="xhtml.style.attrib">
    <optional>
      <attribute name="style"/>
    </optional>
  </define>
  <define name="xhtml.Common.attrib" combine="interleave">
    <ref name="xhtml.style.attrib"/>
  </define>
</grammar>

C.1.21. Style Sheet

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Style Module</x:h1>
  <div>
    <x:h2>The style element</x:h2>
    <define name="xhtml.style">
      <element name="style">
        <ref name="xhtml.style.attlist"/>
        <ref name="xhtml.style.content"/>        
      </element>
    </define>
    <define name="xhtml.style.attlist">
      <ref name="xhtml.Common.attrib"/>
      <optional>
        <attribute name="disabled">
          <value>disabled</value>
        </attribute>     
      </optional>
    </define>
    <define name="xhtml.style.content">
      <text/>    
    </define>
  </div>
  <define name="xhtml.head.misc" combine="choice">
    <ref name="xhtml.style"/>
  </define>
</grammar>

C.1.22. Tables

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"         
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Tables Module</x:h1>
  <x:p>Note. Also include the Caption Module when this module is used.</x:p>
  <div>
    <x:h2>The table element</x:h2>
    <define name="xhtml.table">
      <element name="table">
        <ref name="xhtml.table.attlist"/>
        <ref name="xhtml.table.content"/>
      </element>
    </define>
    <define name="xhtml.table.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.table.content">
        <optional>
          <ref name="xhtml.title"/>
        </optional>        
        <optional>
          <ref name="xhtml.caption"/>
        </optional>
        <optional>
          <ref name="xhtml.summary"/>
        </optional>
        <choice>
          <zeroOrMore>
            <ref name="xhtml.col"/>
          </zeroOrMore>
          <zeroOrMore>
            <ref name="xhtml.colgroup"/>
          </zeroOrMore>
        </choice>
        <choice>
          <group>
            <optional>
              <ref name="xhtml.thead"/>
            </optional>
            <optional>
              <ref name="xhtml.tfoot"/>
            </optional>
            <oneOrMore>
              <ref name="xhtml.tbody"/>
            </oneOrMore>
          </group>
          <oneOrMore>
            <ref name="xhtml.tr"/>
          </oneOrMore>
        </choice>
    </define>
  </div>
  <div>
    <x:h2>The summary element</x:h2>
    <define name="xhtml.summary">
      <element name="summary">
        <ref name="xhtml.summary.attlist"/>
        <ref name="xhtml.summary.content"/>        
      </element>
    </define>
    <define name="xhtml.summary.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.summary.content">    
      <ref name="xhtml.Flow.model"/>
    </define>  
  </div>
  <div>
    <x:h2>The col element</x:h2>
    <define name="xhtml.col">
      <element name="col">
        <ref name="xhtml.col.attlist"/>
      </element>
    </define>
    <define name="xhtml.col.attlist">
      <ref name="xhtml.Common.attrib"/>
      <ref name="xhtml.span.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The colgroup element</x:h2>
    <define name="xhtml.colgroup">
      <element name="colgroup">
        <ref name="xhtml.colgroup.attlist"/>
        <ref name="xhtml.colgroup.content"/>
      </element>
    </define>
    <define name="xhtml.colgroup.attlist">
      <ref name="xhtml.Common.attrib"/>
      <ref name="xhtml.span.attrib"/>
    </define>
    <define name="xhtml.colgroup.content">
      <zeroOrMore>
        <ref name="xhtml.col"/>
      </zeroOrMore>
    </define>
  </div>
  <div>
    <x:h2>The thead element</x:h2>
    <define name="xhtml.thead">
      <element name="thead">
        <ref name="xhtml.thead.attlist"/>
        <ref name="xhtml.thead.content"/>
      </element>
    </define>
    <define name="xhtml.thead.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.thead.content">
      <oneOrMore>
        <ref name="xhtml.tr"/>
      </oneOrMore>
    </define>
  </div>
  <div>
    <x:h2>The tfoot element</x:h2>
    <define name="xhtml.tfoot">
      <element name="tfoot">
        <ref name="xhtml.tfoot.attlist"/>
        <ref name="xhtml.tfoot.content"/>      
      </element>
    </define>
    <define name="xhtml.tfoot.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.tfoot.content">
      <oneOrMore>
        <ref name="xhtml.tr"/>
      </oneOrMore>
    </define>    
  </div>
  <div>
    <x:h2>The tbody element</x:h2>
    <define name="xhtml.tbody">
      <element name="tbody">
        <ref name="xhtml.tbody.attlist"/>
        <ref name="xhtml.tbody.content"/>
     </element>
    </define>
    <define name="xhtml.tbody.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.tbody.content">
      <oneOrMore>
        <ref name="xhtml.tr"/>
      </oneOrMore>
    </define>    
  </div>
  <div>
    <x:h2>The tr element</x:h2>
    <define name="xhtml.tr">
      <element name="tr">
        <ref name="xhtml.tr.attlist"/>
        <ref name="xhtml.tr.content"/>        
      </element>
    </define>
    <define name="xhtml.tr.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
	<define name="xhtml.tr.content">
      <oneOrMore>
        <choice>
          <ref name="xhtml.th"/>
          <ref name="xhtml.td"/>
        </choice>
      </oneOrMore>	
	</define>
  </div>
  <div>
    <x:h2>The th element</x:h2>
    <define name="xhtml.th">
      <element name="th">
        <ref name="xhtml.th.attlist"/>
        <ref name="xhtml.th.content"/>        
      </element>
    </define>
    <define name="xhtml.th.attlist">
      <ref name="xhtml.Cell.attrib"/>
    </define>
    <define name="xhtml.th.content">
      <ref name="xhtml.Flow.model"/>
    </define>	  
  </div>
  <div>
    <x:h2>The td element</x:h2>
    <define name="xhtml.td">
      <element name="td">
        <ref name="xhtml.td.attlist"/>
        <ref name="xhtml.td.content"/>        
      </element>
    </define>
    <define name="xhtml.td.attlist">
      <ref name="xhtml.Cell.attrib"/>
    </define>
    <define name="xhtml.td.content">
        <ref name="xhtml.Flow.model"/>    
    </define>
  </div>
  <div>
    <x:h2>Attribute definitions</x:h2>
    <define name="xhtml.span.attrib">
      <optional>
        <!-- a:defaultValue="1" -->
        <attribute name="span">
          <ref name="spanNumber.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="xhtml.Cell.attrib">
      <ref name="xhtml.Common.attrib"/>
      <optional>
        <attribute name="abbr">
          <ref name="Text.datatype"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="axis"/>
      </optional>
      <optional>
        <!-- a:defaultValue="1" -->
        <attribute name="colspan">
          <ref name="Number.datatype"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="headers">
          <ref name="IDREFS.datatype"/>
        </attribute>
      </optional>
      <optional>
        <!-- a:defaultValue="1" -->
        <attribute name="rowspan">
          <ref name="Number.datatype"/>
        </attribute>
      </optional>
      <ref name="xhtml.scope.attrib"/>
    </define>
    <define name="xhtml.scope.attrib">
      <optional>
        <attribute name="scope">
          <choice>
            <value>row</value>
            <value>col</value>
            <value>rowgroup</value>
            <value>colgroup</value>
          </choice>
        </attribute>
      </optional>
    </define>
  </div>
  <define name="xhtml.Structural.class" combine="choice">
    <ref name="xhtml.table"/>
  </define>
</grammar>

C.2. XHTML RELAX NG Support Modules

The modules in this section are elements and attributes of the XHTML RELAX NG implementation that, while hidden from casual users, are important to understand when creating derivative markup languages using the Modularization architecture.

C.2.1. Datatypes

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <x:h1>Datatypes Module</x:h1>
  <div>
    <x:h2>Datatypes defined in XML 1.0</x:h2>
    <define name="CDATA.datatype">
      <text/>
    </define>
    <define name="ID.datatype">
      <data type="ID"/>
    </define>
    <define name="IDREF.datatype">
      <data type="IDREF"/>
    </define>
    <define name="IDREFS.datatype">
      <data type="IDREFS"/>
    </define>
    <define name="NAME.datatype">
      <data type="Name"/>
    </define>
    <define name="NMTOKEN.datatype">
      <data type="NMTOKEN"/>
    </define>
    <define name="NMTOKENS.datatype">
      <data type="NMTOKENS"/>
    </define>
  </div>
  <div>
    <x:h2>CURIE Datatypes</x:h2>
    <define name="CURIE.datatype">
      <x:p>A single curie</x:p>
      <data type="string">
        <param name="pattern">(([\i-[:]][\c-[:]]*)?:)?.+</param>
        <param name="minLength">1</param>
      </data>
    </define>
    <define name="CURIEs.datatype">
      <x:p>A whitespace separated list of CURIEs</x:p>
      <list>
        <oneOrMore>
          <ref name="CURIE.datatype"/>
        </oneOrMore>
      </list>	
    </define>
    <define name="SafeCURIE.datatype">
      <x:p>A single safe_curie</x:p>
      <data type="string">
        <param name="pattern">\[(([\i-[:]][\c-[:]]*)?:)?.+\]</param>
        <param name="minLength">3</param>
      </data>
    </define>
    <define name="SafeCURIEs.datatype">
      <x:p>A whitespace separated list of SafeCURIEs</x:p>
      <list>
        <oneOrMore>
          <ref name="SafeCURIE.datatype"/>
        </oneOrMore>
      </list>	    
    </define>
    <define name="URIorSafeCURIE.datatype">
      <x:p>A URI or a SafeCURIE (since you need a SafeCURIE 
        to disambiguate between a common URI and a CURIE)</x:p>
      <choice>
        <ref name="URI.datatype"/>
        <ref name="CURIE.datatype"/>
      </choice>
    </define>
    <define name="URIorSafeCURIEs.datatype">
      <x:p>A whitespace separated list of URIorSafeCURIEs</x:p>
      <list>
        <oneOrMore>
          <ref name="URIorSafeCURIE.datatype"/>
        </oneOrMore>
      </list>    
    </define>    
  </div>
  <div>
    <x:h2>Additional Datatypes</x:h2>
    <define name="Character.datatype">
      <x:p>A single character, as per section 2.2 of [XML].</x:p>
      <data type="string">
        <param name="length">1</param>
      </data>
    </define>
    <define name="Characters.datatype">
      <data type="string"/>
    </define>
    <define name="Charset.datatype">
      <x:p>A character encoding, as per [RFC2045]</x:p>
      <text/>
    </define>
    <define name="Encodings.datatype">
      <x:p>A comma-separated list of 'charset's with optional q parameters,
        as defined in section 14.2 of [RFC2616] as the field value of
        the Accept-Charset request header.</x:p>
      <text/>
    </define>
    <define name="ContentType.datatype">
      <x:p>Media type, as per [RFC2045]</x:p>
      <text/>
    </define>
    <define name="ContentTypes.datatype">
      <x:p>A list of media ranges with optional accept parameters,
        as defined in section 14.1 of [RFC2616] as the field value
        of the accept request header.</x:p>
      <text/>
    </define>
    <define name="Coordinates.datatype">
      <x:p>Comma separated list of Lengths used in defining areas.</x:p>
      <data type="string">
        <param name="pattern">(\d+|\d+(\.\d+)?%)(,\s*(\d+|\d+(\.\d+)?%))*</param>
      </data>
    </define>
    <define name="Datetime.datatype">
      <x:p>Date and time information, as defined by the type dateTime
        in [XMLSCHEMA].</x:p>
      <data type="dateTime"/>
    </define>
    <define name="HrefTarget.datatype">
      <x:p>Name used as destination for results of certain actions.</x:p>
      <ref name="NMTOKEN.datatype"/>
    </define>
    <define name="LanguageCode.datatype">
      <x:p>A language code, as per [RFC3066].</x:p>
      <data type="language"/>
    </define>
    <define name="LanguageCodes.datatype">
      <x:p>A comma-separated list of language ranges.</x:p>
      <text/>
    </define>
    <define name="Length.datatype">
      <x:p>The value may be either in pixels or a percentage of the available
        horizontal or vertical space. Thus, the value "50%" means half of
        the available space.</x:p>
      <data type="string">
        <param name="pattern">(\d+|\d+(\.\d+)?%)</param>
      </data>
    </define>
    <define name="LocationPath.datatype">
      <x:p>A location path as defined in [XPATH].</x:p>
      <text/>
    </define>
    <define name="MediaDesc.datatype">
      <x:p>A comma-separated list of media descriptors as described by [CSS].
        The default is all.</x:p>
      <data type="string">
        <param name="pattern">[^,]+(,\s*[^,]+)*</param>
      </data>
    </define>
    <define name="Number.datatype">
      <x:p>One or more digits (NUMBER).</x:p>
      <data type="nonNegativeInteger">
        <param name="pattern">[0-9]+</param>
      </data>
    </define>
    <define name="spanNumber.datatype">
      <x:p>span: this attribute value must be an integer > 0;
        the default value is 1.</x:p>
      <data type="positiveInteger">
        <param name="pattern">[0-9]+</param>
      </data>
    </define>
    <define name="QName.datatype">
      <x:p>An [XMLNS]-qualified name.</x:p>
      <data type="QName"/>
    </define>
    <define name="QNames.datatype">
      <x:p>One or more white space separated QName values.</x:p>
      <list>
        <oneOrMore>
          <data type="QName"/>
        </oneOrMore>
      </list>
    </define>
    <define name="prefixedQName.datatype">
      <x:p>An [XMLNS]-qualified name.</x:p>
      <data type="QName">
        <param name="pattern">[\i-[:]][\c-[:]]*:[\i-[:]][\c-[:]]*</param>
      </data>
    </define>
    <define name="Shape.datatype">
      <x:p>The shape of a region.</x:p>
      <choice>
        <value>default</value>
        <value>rect</value>
        <value>circle</value>
        <value>poly</value>
      </choice>
    </define>
    <define name="Text.datatype">
      <x:p>Arbitrary textual data, likely meant to be human-readable.</x:p>
      <text/>
    </define>
    <define name="URI.datatype">
      <x:p>A Uniform Resource Identifier Reference, as defined by the type
        anyURI in [XMLSCHEMA].</x:p>
      <data type="anyURI"/>
    </define>
    <define name="URIs.datatype">
      <x:p>A space-separated list of URIs as defined above.</x:p>
      <list>
        <oneOrMore>
          <ref name="URI.datatype"/>
        </oneOrMore>
      </list>
    </define>
    <define name="Boolean.datatype">
      <choice>
	    <value>true</value>
	    <value>false</value>
	  </choice>
	</define>
  </div>
</grammar>

C.2.2. Events

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:ev="http://www.w3.org/2001/xml-events"
         xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Events Attribute Collection Module</x:h1>
  <x:p>This module imports the XMLEvents 2 modules, and
  contextualizes them for the XHTML2 document type.</x:p>
    <x:h2>XHTML Events</x:h2>
    <div>
      <include href="xml-events-2.rng" />
      <define name="xmlEvents.Common.attrib" combine="interleave">
        <ref name="CommonNoEvents.attrib"/>
      </define>
      <define name="xhtml.head.misc" combine="choice">
      	<ref name="xmlEvents.listener"/>
      </define>
      <define name="xhtml.Structural.class" combine="choice">
        <ref name="xmlEvents.listener"/>
      </define>
    </div>
    <x:h2>XML Handlers</x:h2>
    <div>
      <include href="xml-handlers-2.rng" />
      <define name="xmlHandlers.Common.attrib" combine="interleave"> 
        <ref name="CommonNoEvents.attrib"/> 
      </define>                
      <define name="xhtml.head.misc" combine="choice">
        <ref name="xmlHandlers.action"/>
      </define>
      <define name="xhtml.Structural.class" combine="choice">
        <ref name="xmlHandlers.action"/>
      </define>
    </div>
    <x:h2>XML Scripting</x:h2>
    <div>
      <include href="xml-script-2.rng">
        <define name="xmlScripting.script.attlist">    
          <ref name="xmlScripting.implements.attrib"/>
          <ref name="xmlScripting.charset.attrib"/>
          <ref name="xhtml.Common.attrib"/>
        </define> 
      </include>
      <define name="xmlHandlers.action.content" combine="choice">
        <ref name="xmlScripting.script"/>
      </define>
      <define name="xhtml.head.misc" combine="choice">
        <ref name="xmlScripting.script"/>
      </define>
      <define name="xhtml.Structural.class" combine="choice">
        <ref name="xmlScripting.script"/>
      </define>
      <define name="xhtml.Text.class" combine="choice">
        <ref name="xmlScripting.script"/>
      </define>
    </div>
  <x:h2>Events Global Attributes Collection</x:h2>
  <div>
    <define name="Events.attrib">
      <optional>
        <ref name="xmlEvents.event.attrib"/>
      </optional>
      <optional>
        <ref name="xmlEvents.observer.attrib"/>
      </optional>    
      <optional>
        <ref name="xmlEvents.eventTarget.attrib"/>
      </optional>
      <optional>
        <ref name="xmlEvents.function.attrib"/>
      </optional>
      <optional>
        <ref name="xmlEvents.handler.attrib"/>
      </optional>    
      <optional>
        <ref name="xmlEvents.phase.attrib"/>
      </optional>    
      <optional>
        <ref name="xmlEvents.propagate.attrib"/>
      </optional>
      <optional>
        <ref name="xmlEvents.defaultAction.attrib"/>
      </optional>
    </define>
  </div>
  <define name="xhtml.Common.attrib" combine="interleave">
    <ref name="Events.attrib"/>
  </define>
  <!-- A specialized class to avoid duplicate includes of events attributes.
  This class should be an echo of Common.attrib, minus Events.attrib 
  We break the pattern of modules contributing themselves to global
  classes, since this is a local concern.
   -->
  <define name="CommonNoEvents.attrib">
    <ref name="xhtml.Common.extra.attrib"/>    
    <ref name="xhtml.Core.attrib"/>
    <ref name="xhtml.Edit.attrib"/>
    <ref name="xhtml.Embedding.attrib"/>
    <ref name="xhtml.Hypertext.attrib"/>
    <ref name="xhtml.I18n.attrib"/>
    <ref name="xhtml.role.attrib"/>
    <ref name="rdfa.Metadata.attrib"/>
    <ref name="xhtml.media.attrib"/>
    <ref name="xhtml.style.attrib"/>
    <ref name="xhtml.Map.attrib"/>
  </define>
</grammar>

C.2.3. Param

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"         
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Param Module</x:h1>
  <div>
    <x:h2>The param element</x:h2>
    <define name="xhtml.param">
      <element name="param">
        <ref name="xhtml.param.attlist"/>
        <empty/>
      </element>
    </define>
    <define name="xhtml.param.attlist">
      <attribute name="name"/>
      <optional>
        <attribute name="value"/>
      </optional>
      <optional>
        <!-- a:defaultValue="data" -->
        <attribute name="valuetype">
          <choice>
            <value>data</value>
            <value>ref</value>
            <value>object</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="type">
          <ref name="ContentTypes.datatype"/>
        </attribute>
      </optional>
    </define>
  </div>
</grammar>

C.2.4. Caption

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"         
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Caption Module</x:h1>
  <div>
    <x:h2>The caption element</x:h2>
    <define name="xhtml.caption">
      <element name="caption">
        <ref name="xhtml.caption.attlist"/>
        <ref name="xhtml.caption.content"/>        
      </element>
    </define>
    <define name="xhtml.caption.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.caption.content">
      <ref name="xhtml.Text.model"/>
    </define>    
    <define name="xhtml.Text.class" combine="choice">
      <ref name="xhtml.caption"/>
    </define>
  </div>
</grammar>

C.2.5. Role Attribute

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Role Attribute Module</x:h1>
  <define name="xhtml.role.attrib">
    <optional>
      <attribute name="role">
	    <ref name="role.content"/>        
      </attribute>
    </optional>
  </define>
  <define name="role.content" combine="choice">
    <ref name="CURIEs.datatype"/>
  </define>
  <define name="xhtml.Common.attrib" combine="interleave">
    <ref name="xhtml.role.attrib"/>
  </define>
</grammar>

C.3. XHTML RELAX NG Legacy Modules

C.3.1. Legacy Edit

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
    <x:h1>Legacy Edit Module</x:h1>
    <div>
      <x:h2>The ins element</x:h2>     
      <define name="xhtml.ins">
        <element name="ins">
          <ref name="xhtml.ins.attlist"/>
          <ref name="xhtml.ins.content"/>
        </element>
      </define>
      <define name="xhtml.ins.attlist">
        <ref name="xhtml.Common.attrib"/>
      </define>
      <define name="xhtml.ins.content">
        <ref name="xhtml.Text.model"/>
      </define>
    </div>
    <div>
      <x:h2>The del element</x:h2>     
      <define name="xhtml.del">
        <element name="del">
          <ref name="xhtml.del.attlist"/>
          <ref name="xhtml.del.content"/>
        </element>
      </define>
      <define name="xhtml.del.attlist">
        <ref name="xhtml.Common.attrib"/>
      </define>
      <define name="xhtml.del.content">
        <ref name="xhtml.Text.model"/>
      </define>
    </div>
    <define name="xhtml.Text.class" combine="choice">
      <ref name="xhtml.ins"/>
      <ref name="xhtml.del"/>
    </define>
</grammar>

C.3.2. Legacy Headings

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
    <x:h1>Legacy Headings Module</x:h1>
    <define name="xhtml.h1">
      <element name="h1">
        <ref name="xhtml.legacyh.attlist"/>
        <ref name="xhtml.legacyh.content"/>
      </element>
    </define>
    <define name="xhtml.h2">
      <element name="h2">
        <ref name="xhtml.legacyh.attlist"/>
        <ref name="xhtml.legacyh.content"/>
      </element>
    </define>
    <define name="xhtml.h3">
      <element name="h3">
        <ref name="xhtml.legacyh.attlist"/>
        <ref name="xhtml.legacyh.content"/>
      </element>
    </define>
    <define name="xhtml.h4">
      <element name="h4">
        <ref name="xhtml.legacyh.attlist"/>
        <ref name="xhtml.legacyh.content"/>
      </element>
    </define>
    <define name="xhtml.h5">
      <element name="h5">
        <ref name="xhtml.legacyh.attlist"/>
        <ref name="xhtml.legacyh.content"/>
      </element>
    </define>
    <define name="xhtml.h6">
      <element name="h6">
        <ref name="xhtml.legacyh.attlist"/>
        <ref name="xhtml.legacyh.content"/>
      </element>
    </define>
    <define name="xhtml.legacyh.attlist">
      <ref name="xhtml.Structural.attrib"/>
    </define>
    <define name="xhtml.legacyh.content">
      <ref name="xhtml.Text.model"/>
    </define>
    <define name="xhtml.Heading.class" combine="choice">
      <choice>
        <ref name="xhtml.h1"/>
        <ref name="xhtml.h2"/>
        <ref name="xhtml.h3"/>
        <ref name="xhtml.h4"/>
        <ref name="xhtml.h5"/>
        <ref name="xhtml.h6"/>
      </choice>
    </define>
</grammar>

C.3.3. Legacy Line Break

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
    <x:h1>Legacy Line Break Module</x:h1>
    <define name="xhtml.br">
      <element name="br">
        <ref name="xhtml.br.attlist"/>
        <ref name="xhtml.br.content"/>
      </element>
    </define>
    <define name="xhtml.br.attlist">
      <ref name="xhtml.Common.attrib"/>
    </define>
    <define name="xhtml.br.content">
      <empty/>
    </define>
    <define name="xhtml.Text.class" combine="choice">
      <ref name="xhtml.br"/>
    </define>
</grammar>

C.4. RELAX NG External Modules

These modules are not defined by XHTML, but these definitions are included here for completeness.

C.4.1. Ruby

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <x:h1>Ruby Module in RELAX NG</x:h1>
  <x:pre>
    Ruby Elements
      ruby, rbc, rtc, rb, rt, rp
    This module defines grammars to support ruby annotation markup.
    This module is based on the W3C Ruby Annotation Specification:
      http://www.w3.org/TR/ruby
    Copyright &#xA9;2003 W3C&#xAE; (MIT, ERCIM, Keio), All Rights Reserved.
      Editor:   Masayasu Ishikawa &lt;mimasa@w3.org&gt;
      Revision: $Id: ruby-1.rng,v 1.9 2004/07/21 09:46:41 mimasa Exp $
    Permission to use, copy, modify and distribute this RELAX NG schema
    for Ruby Annotation and its accompanying documentation for any purpose
    and without fee is hereby granted in perpetuity, provided that the above
    copyright notice and this paragraph appear in all copies. The copyright
    holders make no representation about the suitability of this RELAX NG
    schema for any purpose.
    It is provided "as is" without expressed or implied warranty.
    For details, please refer to the W3C software license at:
      <x:a href="http://www.w3.org/Consortium/Legal/copyright-software"
      >http://www.w3.org/Consortium/Legal/copyright-software</x:a>
  </x:pre>
  <div>
    <x:h2>patterns for the content model of the ruby element</x:h2>
    <define name="Ruby.content.simple">
      <x:p>Content model of simple ruby</x:p>
      <group>
        <ref name="rb"/>
        <choice>
          <ref name="rt-simple"/>
          <group>
            <ref name="rp"/>
            <ref name="rt-simple"/>
            <ref name="rp"/>
          </group>
        </choice>
      </group>
    </define>
    <define name="Ruby.content.complex">
      <x:p>Content model of complex ruby</x:p>
      <group>
        <ref name="rbc"/>
        <ref name="rtc"/>
        <optional>
          <ref name="rtc"/>
        </optional>
      </group>
    </define>
    <define name="Ruby.content">
      <x:p>Simple ruby is used by default</x:p>
      <ref name="Ruby.content.simple"/>
    </define>
  </div>
  <div>
    <x:h2>Ruby Elements</x:h2>
    <x:h3>ruby element</x:h3>
    <define name="ruby">
      <element name="ruby">
        <ref name="Ruby.content"/>
        <ref name="Ruby.common.attrib"/>
      </element>
    </define>
    <x:h3>rbc (ruby base component) element</x:h3>
    <define name="rbc">
      <element name="rbc">
        <oneOrMore>
          <ref name="rb"/>
        </oneOrMore>
        <ref name="Ruby.common.attrib"/>
      </element>
    </define>
    <x:h3>rtc (ruby text component) element</x:h3>
    <define name="rtc">
      <element name="rtc">
        <oneOrMore>
          <ref name="rt-complex"/>
        </oneOrMore>
        <ref name="Ruby.common.attrib"/>
      </element>
    </define>
    <x:h3>rb (ruby base) element</x:h3>
    <define name="rb">
      <element name="rb">
        <ref name="NoRuby.content"/>
        <ref name="Ruby.common.attrib"/>
      </element>
    </define>
    <x:h3>rt (ruby text) element</x:h3>
    <define name="rt-simple">
      <x:p>grammar for simple ruby</x:p>
      <x:p>rbspan attribute is not allowed in simple ruby</x:p>
      <element name="rt">
        <ref name="NoRuby.content"/>
        <ref name="Ruby.common.attrib"/>
      </element>
    </define>
    <define name="rt-complex">
      <x:p>grammar for complex ruby</x:p>
      <element name="rt">
        <ref name="NoRuby.content"/>
        <ref name="Ruby.common.attrib"/>
        <optional>
          <!-- mgylling: remove a:defaultValue="1" on rbspan as it competes with
          the rt-simple pattern. See http://lists.dsdl.org/dsdl-discuss/2008-05/0003.html
          Jing does not catch this, but MSV does.
          -->
          <attribute name="rbspan">
            <data type="positiveInteger">
              <param name="pattern">[1-9][0-9]*</param>
            </data>
          </attribute>
        </optional>
      </element>
    </define>
    <x:h3>rp (ruby parenthesis) element</x:h3>
    <define name="rp">
      <element name="rp">
        <text/>
        <ref name="Ruby.common.attrib"/>
      </element>
    </define>
  </div>
  <div>
    <x:h2>Ruby Common Attributes</x:h2>
    <x:p>Ruby elements are intended to have common attributes of its
      parent markup language. The pattern "xhtml.Common.attrib" MUST be
      defined to integrate this module.</x:p>
    <define name="Ruby.common.attrib">
      <ref name="xhtml.Common.attrib"/>
    </define>
  </div>
  <div>
    <x:p>Content models of the rb and the rt elements are intended to
      allow other inline-level elements of its parent markup language,
      but it should not include ruby descendent elements. This RELAX NG
      module itself doesn't check nesting of ruby elements.
      The patterns "Inline.class" and "Inline.model" MUST be defined
      to integrate this module.</x:p>
    <define name="Inline.class" combine="choice">
      <ref name="ruby"/>
    </define>
    <define name="NoRuby.content">
      <ref name="Inline.model"/>
    </define>
  </div>
</grammar>

C.4.2. Ruby Driver for Full Ruby Markup

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Ruby Module in RELAX NG for full ruby markup</x:h1>
  <x:pre>
    Copyright &#xA9;2003 W3C&#xAE; (MIT, ERCIM, Keio), All Rights Reserved.
      Editor:   Masayasu Ishikawa &lt;mimasa@w3.org&gt;
      Revision: $Id: full-ruby-1.rng,v 1.4 2003/04/30 06:50:03 mimasa Exp $
  </x:pre>
  <include href="ruby-1.rng"/>
  <define name="Ruby.content" combine="choice">
    <x:p>Allow complex ruby markup in addition to simple ruby markup</x:p>
    <ref name="Ruby.content.complex"/>
  </define>
</grammar>

C.4.3. XML Events

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"         
         xmlns:x="http://www.w3.org/1999/xhtml"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <x:h1>XML Events Module in RELAX NG</x:h1>
  <x:pre>
    This is the RELAX NG Schema for the XML Events 2 XML Events module.
    Copyright &#xA9;2003-2009 W3C&#xAE; (MIT, ERCIM, Keio), All Rights Reserved.
    URI: http://www.w3.org/MarkUp/RELAXNG/xml-events-2.rng
    Editors:   Masayasu Ishikawa &lt;mimasa@w3.org&gt;
               Markus Gylling &lt;markus.gylling@tpb.se&gt;
    Revision: $Id: xml-events-2.rng,v 1.1.2.3 2009/02/25 12:09:46 mgylling Exp $
    Permission to use, copy, modify and distribute this RELAX NG schema
    for XML Events and its accompanying documentation for any purpose and
    without fee is hereby granted in perpetuity, provided that the above
    copyright notice and this paragraph appear in all copies. The copyright
    holders make no representation about the suitability of this RELAX NG
    schema for any purpose.
    It is provided "as is" without expressed or implied warranty.
    For details, please refer to the W3C software license at:
      <x:a href="http://www.w3.org/Consortium/Legal/copyright-software"
      >http://www.w3.org/Consortium/Legal/copyright-software</x:a>
  </x:pre>
  <define name="xmlEvents.listener">
    <element name="listener">
      <ref name="xmlEvents.listener.attlist"/>
    </element>
  </define>
  <define name="xmlEvents.listener.attlist">
	<ref name="xmlEvents.event.attrib"/>
    <optional>
      <ref name="xmlEvents.observer.attrib"/>
    </optional>    
    <optional>
      <ref name="xmlEvents.eventTarget.attrib"/>
    </optional>
    <optional>
	  <ref name="xmlEvents.function.attrib"/>
	</optional>
    <optional>
      <ref name="xmlEvents.handler.attrib"/>
    </optional>    
    <optional>
      <ref name="xmlEvents.phase.attrib"/>
    </optional>    
    <optional>
      <ref name="xmlEvents.propagate.attrib"/>
    </optional>
    <optional>
      <ref name="xmlEvents.defaultAction.attrib"/>
    </optional>
    <ref name="xmlEvents.Common.attrib"/>    
  </define>
  <define name="xmlEvents.Common.attrib"> 
    <!-- The host grammar must contribute an
    attribute of type ID to this class -->
    <empty/>
  </define>  
  <define name="xmlEvents.event.attrib">
    <attribute name="event">
      <list>
        <oneOrMore>
          <data type="QName"/>
        </oneOrMore>
      </list>
    </attribute>
  </define>
  <define name="xmlEvents.eventTarget.attrib">    
    <attribute name="eventTarget">
      <data type="IDREFS"/>
    </attribute>    
  </define>
  <define name="xmlEvents.phase.attrib">
    <!-- a:defaultValue="default" -->        
    <attribute name="phase">
      <choice>
        <value>bubble</value>        
        <value>capture</value>
        <value>target</value>          
        <value>default</value>
      </choice>
    </attribute>        
  </define>  
  <define name="xmlEvents.handler.attrib">    
    <attribute name="handler">
      <data type="anyURI"/>
     </attribute>    
  </define>
  <define name="xmlEvents.observer.attrib">    
    <attribute name="observer">
      <data type="IDREFS"/>
    </attribute>    
  </define>
  <define name="xmlEvents.function.attrib">      
      <attribute name="function">
        <text/>
      </attribute>
  </define>    
  <define name="xmlEvents.propagate.attrib">
    <!-- a:defaultValue="continue" -->    
    <attribute name="propagate">
      <choice>
        <value>stop</value>
        <value>continue</value>
      </choice>
    </attribute>    
  </define>  
  <define name="xmlEvents.defaultAction.attrib">
    <!-- a:defaultValue="perform" -->
    <attribute name="defaultAction">
      <choice>
        <value>cancel</value>
        <value>perform</value>
      </choice>
    </attribute>
  </define>
</grammar>

C.4.4. XML Handlers

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <x:h1>XML Handlers Module in RELAX NG</x:h1>
  <x:pre>
    This is the RELAX NG Schema for the XML Events 2 XML Handlers module.
    As per the XMLEvents 2 specification, this modules depends
    on the XML Events Module (xml-events-2.rng).
    Copyright &#xA9;2009 W3C&#xAE; (MIT, ERCIM, Keio), All Rights Reserved.
    URI: http://www.w3.org/MarkUp/RELAXNG/xml-handlers-2.rng
    Editor:   Markus Gylling &lt;markus.gylling@tpb.se&gt;
    Revision: $Id: xml-handlers-2.rng,v 1.1.2.3 2009/02/25 12:09:46 mgylling Exp $
    Permission to use, copy, modify and distribute this RELAX NG schema
    for XML Handlers and its accompanying documentation for any purpose and
    without fee is hereby granted in perpetuity, provided that the above
    copyright notice and this paragraph appear in all copies. The copyright
    holders make no representation about the suitability of this RELAX NG
    schema for any purpose.
    It is provided "as is" without expressed or implied warranty.
    For details, please refer to the W3C software license at:
      <x:a href="http://www.w3.org/Consortium/Legal/copyright-software"
      >http://www.w3.org/Consortium/Legal/copyright-software</x:a>
  </x:pre>
  <define name="xmlHandlers.action">
  	<element name="action">
  		<ref name="xmlHandlers.action.attlist"/>
  		<ref name="xmlHandlers.action.content"/>
  	</element>
  </define>
  <define name="xmlHandlers.action.attlist">
    <ref name="xmlEvents.event.attrib"/>
    <optional>
      <ref name="xmlEvents.eventTarget.attrib"/>
    </optional>          
    <ref name="xmlHandlers.declare.attrib"/>
    <ref name="xmlHandlers.if.attrib"/>
    <ref name="xmlHandlers.while.attrib"/>
    <ref name="xmlHandlers.Common.attrib"/>        
  </define>
  <define name="xmlHandlers.action.content">
  	<choice>
  	  <ref name="xmlHandlers.action"/>
  	  <ref name="xmlHandlers.dispatchEvent"/>
  	  <ref name="xmlHandlers.addEventListener"/>
  	  <ref name="xmlHandlers.removeEventListener"/>
  	  <ref name="xmlHandlers.stopPropagation"/>
  	  <ref name="xmlHandlers.preventDefault"/>  		  		  		  		
  	</choice>  
  </define>
  <define name="xmlHandlers.dispatchEvent">
  	<element name="dispatchEvent">
      <ref name="xmlHandlers.dispatchEvent.attlist"/>  	
  	  <empty/>
  	</element>
  </define>
  <define name="xmlHandlers.dispatchEvent.attlist">
    <ref name="xmlHandlers.Common.attrib"/>    
    <ref name="xmlHandlers.eventType.attrib"/>
    <ref name="xmlEvents.eventTarget.attrib"/>
    <ref name="xmlHandlers.bubbles.attrib"/>
    <ref name="xmlHandlers.cancelable.attrib"/>     
  </define>
  <define name="xmlHandlers.addEventListener">
   	<element name="addEventListener">
      <ref name="xmlHandlers.addEventListener.attlist"/>
  	  <empty/>
  	</element> 
  </define>  
  <define name="xmlHandlers.addEventListener.attlist">
  	<ref name="xmlHandlers.removeEventListener.attlist"/>
  </define>
  <define name="xmlHandlers.removeEventListener">
   	<element name="removeEventListener">
      <ref name="xmlHandlers.removeEventListener.attlist"/>   	
  	  <empty/>
  	</element>  
  </define>
  <define name="xmlHandlers.removeEventListener.attlist">
    <ref name="xmlHandlers.event.attrib"/>
    <ref name="xmlEvents.handler.attrib"/>
    <optional>
      <ref name="xmlEvents.phase.attrib"/>
    </optional>              
    <ref name="xmlHandlers.Common.attrib"/>
  </define>  
  <define name="xmlHandlers.stopPropagation">
   	<element name="stopPropagation">
   	  <ref name="xmlHandlers.stopPropagation.attlist"/>   
  	  <empty/>
  	</element>      
  </define>   
  <define name="xmlHandlers.stopPropagation.attlist">
    <ref name="xmlHandlers.Common.attrib"/>
    <ref name="xmlHandlers.event.attrib"/>
  </define>  
  <define name="xmlHandlers.preventDefault">
   	<element name="preventDefault">
      <ref name="xmlHandlers.preventDefault.attlist"/>
  	  <empty/>
  	</element>        
  </define> 
  <define name="xmlHandlers.preventDefault.attlist">
    <ref name="xmlHandlers.Common.attrib"/>
    <ref name="xmlHandlers.event.attrib"/>
  </define>  
  <define name="xmlHandlers.Common.attrib">
    <!-- The host grammar must contribute an
    attribute of type ID to this class -->
    <empty/> 
  </define>
  <define name="xmlHandlers.event.attrib">
    <attribute name="event">
      <data type="QName"/>
    </attribute>
  </define>  
  <define name="xmlHandlers.declare.attrib">
    <optional>
      <attribute name="declare">
        <value>declare</value>
      </attribute>
    </optional>  
  </define>	
  <define name="xmlHandlers.if.attrib">
    <optional>
      <attribute name="if">
      	<data type="normalizedString"/>
      </attribute>
    </optional>
  </define>    
  <define name="xmlHandlers.while.attrib">
    <optional>
      <attribute name="while">
      	<data type="normalizedString"/>
      </attribute>
    </optional>
  </define>    
  <define name="xmlHandlers.eventType.attrib">
    <attribute name="eventType">
      	<data type="QName"/>
    </attribute>
  </define>  
  <define name="xmlHandlers.bubbles.attrib">
    <optional>
      <attribute name="bubbles">
      	<value>bubbles</value>
      </attribute>
    </optional>  
  </define>  
  <define name="xmlHandlers.cancelable.attrib">
    <optional>
      <attribute name="cancelable">
      	<value>cancelable</value>
      </attribute>
    </optional>
  </define>    
</grammar>  

C.4.5. XML Script

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <x:h1>XML Scripting Module in RELAX NG</x:h1>
  <x:p>This module depends on xhtml-datatypes-2.rng</x:p>
  <x:pre>
    This is the RELAX NG Schema for the XML Events 2 Scripting module.
    Copyright &#xA9;2009 W3C&#xAE; (MIT, ERCIM, Keio), All Rights Reserved.
    URI: http://www.w3.org/MarkUp/RELAXNG/xml-script-2.rng
    Editor:   Markus Gylling &lt;markus.gylling@tpb.se&gt;
    Revision: $Id: xml-script-2.rng,v 1.1.2.3 2009/02/25 12:09:46 mgylling Exp $
    Permission to use, copy, modify and distribute this RELAX NG schema
    for XML Scripting and its accompanying documentation for any purpose and
    without fee is hereby granted in perpetuity, provided that the above
    copyright notice and this paragraph appear in all copies. The copyright
    holders make no representation about the suitability of this RELAX NG
    schema for any purpose.
    It is provided "as is" without expressed or implied warranty.
    For details, please refer to the W3C software license at:
    <x:a href="http://www.w3.org/Consortium/Legal/copyright-software"
    >http://www.w3.org/Consortium/Legal/copyright-software</x:a>
  </x:pre>
  <define name="xmlScripting.script">
    <element name="script">
      <ref name="xmlScripting.script.attlist"/>
      <ref name="xmlScripting.script.model"/>    	
    </element>  
  </define>
  <define name="xmlScripting.script.attlist">
    <ref name="xmlScripting.encoding.attrib"/>
    <ref name="xmlScripting.charset.attrib"/>
    <ref name="xmlScripting.defer.attrib"/>    
    <ref name="xmlScripting.implements.attrib"/>
    <ref name="xmlScripting.src.attrib"/>
    <ref name="xmlScripting.type.attrib"/> 
    <ref name="xmlScripting.Common.attrib"/>           
  </define>         
  <define name="xmlScripting.script.model">
  	<text/>
  </define>
  <define name="xmlScripting.encoding.attrib">
    <optional>
      <attribute name="encoding">      	
        <ref name="Encodings.datatype"/>  	
      </attribute>
    </optional>
  </define>
  <define name="xmlScripting.charset.attrib">
    <optional>
      <attribute name="charset">      	
  	    <ref name="Charset.datatype"/>
      </attribute>
    </optional>
  </define>
  <define name="xmlScripting.defer.attrib">
    <optional>
      <attribute name="defer">
      	<value>defer</value>
      </attribute>
    </optional>  	
  </define>
  <define name="xmlScripting.Common.attrib">
    <!-- The host grammar must contribute an
    attribute of type ID to this class -->
    <empty/>
  </define>
  <define name="xmlScripting.implements.attrib">
    <optional>
      <attribute name="implements">        
        <ref name="URIorSafeCURIEs.datatype"/>          
      </attribute>
    </optional>  	
  </define>
  <define name="xmlScripting.src.attrib">
    <optional>
      <attribute name="src">
        <ref name="URI.datatype"/>      
      </attribute>
    </optional>  	
  </define>
   <define name="xmlScripting.type.attrib">
    <attribute name="type">
      <ref name="ContentType.datatype"/>
    </attribute>      	
  </define>
</grammar>         

C.4.6. XML Schema instance

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         ns="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <define name="XSI.type">
    <attribute name="xsi:type">
      <data type="QName"/>
    </attribute>
  </define>
  <define name="XSI.nil">
    <attribute name="xsi:nil">
      <data type="boolean"/>
    </attribute>
  </define>
  <define name="XSI.schemaLocation">
    <attribute name="xsi:schemaLocation">
      <list>
        <oneOrMore>
          <data type="anyURI"/>
          <data type="anyURI"/>
        </oneOrMore>
      </list>
    </attribute>
  </define>
  <define name="XSI.noNamespaceSchemaLocation">
    <attribute name="xsi:noNamespaceSchemaLocation">
      <data type="anyURI"/>
    </attribute>
  </define>
</grammar>

C.4.7. XForms 1.1

<?xml version="1.0" encoding="UTF-8"?>
<!--
   Copyright 2004-2005 Brain Attic, L.L.C.
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
       http://www.apache.org/licenses/LICENSE-2.0
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<!--
  Draft version of for XForms 1.1 by Leigh L. Klotz, Jr. <Leigh.Klotz@Xerox.com>
  Changes from version of http://lists.w3.org/Archives/Public/public-forms/2008Jun/0023.html
  + added mediatype to output
  + added attribute context to Nodeset.Binding.attrib
  + added attribute context { XPathExpression }? to Single.Node.Binding.attrib
  Changes for integration with XHTML2 by Markus Gylling <markus.gylling@gmail.com>
  + remove start element
  + make chameleon (remove xforms ns)
  + use prefixed define names
  TODO submission doesnt have @target?
-->
<grammar 
	xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
	xmlns="http://relaxng.org/ns/structure/1.0" 
	datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <define name="xforms.Common.attrib">
    <!-- host language to add common attributes here -->
    <empty/>
  </define>
  <define name="xforms.Events.attrib">
    <!-- host language to add XML Events attributes here -->
    <empty/>
  </define>
  <define name="xforms.Linking.attrib">
    <!-- host language to add src attribute here -->
    <empty/>
  </define>
  <define name="xforms.Single.Node.Binding.attrib">
    <choice>
      <attribute name="bind">
        <data type="IDREF"/>
      </attribute>
      <group>
        <optional>
          <attribute name="model">
            <data type="IDREF"/>
          </attribute>
        </optional>
        <attribute name="ref">
          <ref name="XPathExpression"/>
        </attribute>
        <optional>
          <attribute name="context">
            <ref name="XPathExpression"/>
          </attribute>
        </optional>
      </group>
    </choice>
  </define>
  <define name="xforms.Nodeset.Binding.attrib">
    <choice>
      <attribute name="bind">
        <data type="IDREF"/>
      </attribute>
      <group>
        <optional>
          <attribute name="model">
            <data type="IDREF"/>
          </attribute>
        </optional>
        <attribute name="nodeset">
          <ref name="XPathExpression"/>
        </attribute>
        <optional>
          <attribute name="context">
            <ref name="XPathExpression"/>
          </attribute>
        </optional>
      </group>
    </choice>
  </define>
  <!-- Placeholder for XML Schema RNG -->
  <define name="xforms.schema">
    <element name="xsd:schema">
      <ref name="xforms.schema.attrib"/>
      <ref name="xforms.schema.content"/>
    </element>
  </define>
  <define name="xforms.schema.attrib">
  	<notAllowed/>
  </define>
  <define name="xforms.schema.content">
    <notAllowed/>
  </define>
  <define name="xforms.model">
    <element name="model">
      <ref name="xforms.model.attrib"/>
      <ref name="xforms.model.content"/>
    </element>
  </define>
  <define name="xforms.model.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <ref name="xforms.actions.attrib"/>
    <optional>
      <attribute name="functions">
        <list>
          <oneOrMore>
            <data type="QName"/>
          </oneOrMore>
        </list>
      </attribute>
    </optional>
    <optional>
      <attribute name="schema">
        <list>
          <oneOrMore>
            <data type="anyURI"/>
          </oneOrMore>
        </list>
      </attribute>
    </optional>
    <optional>
      <attribute name="version">
        <list>
          <data type="string">
            <param name="pattern">[1-9]\d*\.\d+</param>
          </data>
        </list>
      </attribute>
    </optional>
  </define>
  <define name="xforms.model.content">
    <interleave>
      <zeroOrMore>
        <ref name="xforms.instance"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="xforms.submission"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="xforms.bind"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="xforms.schema"/>
      </zeroOrMore>
      <zeroOrMore>
        <ref name="xforms.Actions"/>
      </zeroOrMore>
    </interleave>
  </define>
  <define name="xforms.instance">
    <element name="instance">
      <ref name="xforms.instance.attrib"/>
      <ref name="xforms.instance.content"/>
    </element>
  </define>
  <define name="xforms.instance.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <ref name="xforms.Linking.attrib"/>
    <!--TODO collides with rdf/a resource attribute
    <optional>
      <attribute name="resource">
        <data type="anyURI"/>
      </attribute>
    </optional>
    -->
  </define>
  <define name="xforms.instance.content">
    <optional>
      <ref name="anyElement"/>
    </optional>
  </define>
  <!--
    TODO: Split of Submission.attrib and Submission.Elements isn't right
    because of OR in atttribute and element cases, so interleave is needed
    to combine them, but we use sequence.
  -->
  <define name="xforms.submission">
    <element name="submission">
      <ref name="xforms.submission.model"/>
    </element>
  </define>
  <define name="xforms.submission.model" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <choice>
      <attribute name="method">
        <choice>
          <ref name="QNameButNotNCName"/>
          <value>post</value>
          <value>put</value>
          <value>get</value>
          <value>delete</value>
          <value>post</value>
          <value>form-data-post</value>
          <value>urlencoded-post</value>
        </choice>
      </attribute>
      <element name="method">
        <ref name="xforms.ValueTemplate"/>
      </element>
    </choice>
    <optional>
      <choice>
        <attribute name="bind">
          <data type="IDREF"/>
        </attribute>
        <attribute name="ref">
          <ref name="XPathExpression"/>
        </attribute>
      </choice>
    </optional>
    <choice>
      <attribute name="action">
        <data type="anyURI"/>
      </attribute>
      <!-- TODO collides with rdf/a resource attribute
      <attribute name="resource">
        <data type="anyURI"/>
      </attribute>
      -->
      <element name="resource">
        <ref name="xforms.ValueTemplate"/>
      </element>
    </choice>
    <optional>
      <element name="header">
        <interleave>
          <element name="name">
            <ref name="xforms.ValueTemplate"/>
          </element>
          <element name="value">
            <ref name="xforms.ValueTemplate"/>
          </element>
        </interleave>
      </element>
    </optional>
    <optional>
      <attribute name="includenamespaceprefixes">
        <list>
          <choice>
            <data type="NCName"/>
            <value>#default</value>
          </choice>
        </list>
      </attribute>
    </optional>
    <optional>
      <attribute name="indent">
        <data type="boolean"/>
      </attribute>
    </optional>
    <!-- TODO collides with xhtml common encoding attribute 
    <optional>
      <attribute name="encoding"/>
    </optional>
    -->
    <optional>
      <attribute name="mediatype"/>
    </optional>
    <optional>
      <attribute name="mode">
        <choice>
          <value>asynchronous</value>
          <value>synchronous</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="omit-xml-declaration">
        <data type="boolean"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="standalone">
        <data type="boolean"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="cdata-section-elements">
        <list>
          <oneOrMore>
            <data type="QName"/>
          </oneOrMore>
        </list>
      </attribute>
    </optional>
    <optional>
      <attribute name="replace">
        <choice>
          <ref name="QNameButNotNCName"/>
          <value>all</value>
          <value>instance</value>
          <value>none</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="instance">
        <data type="IDREF"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="relevant">
        <data type="boolean"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="separator">
        <choice>
          <value>;</value>
          <value>&amp;</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="serialization">
        <choice>
          <value>application/xml</value>
          <value>application/x-www-form-urlencoded</value>
          <value>multipart/related</value>
          <value>multipart/form-data</value>
          <value>none</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="validate">
        <data type="boolean"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="version">
        <data type="NMTOKEN"/>
      </attribute>
    </optional>
  </define>
  <!--There should only be zero or one resource, zero or one method, and zero or more header
  <define name="xforms.submission.content">    
    <choice>
      <ref name="xforms.resource"/>
      <ref name="xforms.method"/>
    </choice>
    <optional>
	  <oneOrMore>
	   	<ref name="xforms.header"/>
	  </oneOrMore>
    </optional>
     As is the case everywhere else, action handlers are last 
    <ref name="xforms.Actions"/> 
  </define>
  -->
  <define name="xforms.bind">
    <element name="bind">
      <ref name="xforms.bind.attrib"/>
      <ref name="xforms.bind.content"/>
    </element>
  </define>
  <define name="xforms.bind.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <optional>
      <attribute name="nodeset">
        <ref name="XPathExpression"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="type">
        <data type="QName"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="readonly">
        <ref name="XPathExpression"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="required">
        <ref name="XPathExpression"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="relevant">
        <ref name="XPathExpression"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="constraint">
        <ref name="XPathExpression"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="calculate">
        <ref name="XPathExpression"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="p3ptype"/>
    </optional>
  </define>
  <define name="xforms.bind.content">
    <zeroOrMore>
      <ref name="xforms.bind"/>
    </zeroOrMore>
  </define>
  <!-- Form Controls -->
  <define name="xforms.Core.Form.Controls">
    <choice>
      <ref name="xforms.input"/>
      <ref name="xforms.textarea"/>
      <ref name="xforms.secret"/>
      <ref name="xforms.output"/>
      <ref name="xforms.upload"/>
      <ref name="xforms.select1"/>
      <ref name="xforms.select"/>
      <ref name="xforms.range"/>
      <ref name="xforms.submit"/>
      <ref name="xforms.trigger"/>
    </choice>
  </define>
  <define name="UI.xforms.Common.attrib" combine="interleave">
    <optional>
      <!-- host language to add accesskey and navindex here -->
      <attribute name="appearance">
        <choice>
          <data type="QName">
            <param name="pattern">[^:]+:[^:]+</param>
          </data>
          <value>minimal</value>
          <value>compact</value>
          <value>full</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <define name="xforms.UI.Inline.class">
    <choice>
      <ref name="xforms.output"/>
    </choice>
  </define>
  <define name="xforms.UI.Inline.content">
    <interleave>
      <text/>
      <optional>
        <ref name="xforms.UI.Inline.class"/>
      </optional>
    </interleave>
  </define>
  <define name="xforms.UI.Common.content">
    <zeroOrMore>
      <choice>
        <ref name="xforms.help"/>
        <ref name="xforms.hint"/>
        <ref name="xforms.alert"/>
        <ref name="xforms.Actions"/>
      </choice>
    </zeroOrMore>
  </define>
  <define name="xforms.List.UI.Common.content">
    <oneOrMore>
      <choice>
        <ref name="xforms.item"/>
        <ref name="xforms.itemset"/>
        <ref name="xforms.choices"/>
      </choice>
    </oneOrMore>
  </define>
  <define name="xforms.label.content">
    <ref name="xforms.UI.Inline.content"/>
  </define>
  <define name="xforms.label">
    <element name="label">
      <interleave>
        <ref name="xforms.Common.attrib"/>
        <choice>
          <ref name="xforms.Linking.attrib"/>
          <ref name="xforms.Single.Node.Binding.attrib"/>
          <ref name="xforms.label.content"/>
        </choice>
      </interleave>
    </element>
  </define>
  <define name="xforms.help">
    <element name="help">
      <ref name="xforms.help.attrib"/>
      <ref name="xforms.help.content"/>
    </element>
  </define>
  <define name="xforms.help.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <optional>
      <ref name="xforms.Linking.attrib"/>
    </optional>
    <optional>
      <ref name="xforms.Single.Node.Binding.attrib"/>
    </optional>
  </define>
  <define name="xforms.help.content">
    <ref name="xforms.UI.Inline.content"/>
  </define>
  <define name="xforms.hint">
    <element name="hint">
      <ref name="xforms.hint.attrib"/>
      <ref name="xforms.hint.content"/>
    </element>
  </define>
  <define name="xforms.hint.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <optional>
      <ref name="xforms.Linking.attrib"/>
    </optional>
    <optional>
      <ref name="xforms.Single.Node.Binding.attrib"/>
    </optional>
  </define>
  <define name="xforms.hint.content">
    <ref name="xforms.UI.Inline.content"/>
  </define>
  <define name="xforms.alert">
    <element name="alert">
      <ref name="xforms.alert.attrib"/>
      <ref name="xforms.alert.content"/>
    </element>
  </define>
  <define name="xforms.alert.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <optional>
      <ref name="xforms.Linking.attrib"/>
    </optional>
    <optional>
      <ref name="xforms.Single.Node.Binding.attrib"/>
    </optional>
  </define>
  <define name="xforms.alert.content">
    <ref name="xforms.UI.Inline.content"/>
  </define>
  <define name="xforms.choices">
    <element name="choices">
      <ref name="xforms.choices.attrib"/>
      <ref name="xforms.choices.content"/>
    </element>
  </define>
  <define name="xforms.choices.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
  </define>
  <define name="xforms.choices.content">
    <optional>
      <ref name="xforms.label"/>
    </optional>
    <oneOrMore>
      <choice>
        <ref name="xforms.choices"/>
        <ref name="xforms.item"/>
        <ref name="xforms.itemset"/>
      </choice>
    </oneOrMore>
  </define>
  <define name="xforms.value">
    <element name="value">
      <ref name="xforms.value.attrib"/>
      <ref name="xforms.value.content"/>
    </element>
  </define>
  <define name="xforms.value.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <optional>
      <ref name="xforms.Single.Node.Binding.attrib"/>
    </optional>
  </define>
  <define name="xforms.value.content">
    <text/>
  </define>
  <define name="xforms.item">
    <element name="item">
      <ref name="xforms.item.attrib"/>
      <ref name="xforms.item.content"/>
    </element>
  </define>
  <define name="xforms.item.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
  </define>
  <define name="xforms.item.content">
    <ref name="xforms.label"/>
    <ref name="xforms.value"/>
    <ref name="xforms.UI.Common.content"/>
  </define>
  <define name="xforms.itemset">
    <element name="itemset">
      <ref name="xforms.itemset.attrib"/>
      <ref name="xforms.itemset.content"/>
    </element>
  </define>
  <define name="xforms.itemset.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <ref name="xforms.Nodeset.Binding.attrib"/>
  </define>
  <define name="xforms.itemset.content">
    <ref name="xforms.label"/>
    <choice>
      <ref name="xforms.value"/>
      <ref name="xforms.copy"/>
    </choice>
    <ref name="xforms.UI.Common.content"/>
  </define>
  <define name="xforms.copy">
    <element name="copy">
      <ref name="xforms.copy.attrib"/>
      <ref name="xforms.copy.content"/>
    </element>
  </define>
  <define name="xforms.copy.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <ref name="xforms.Single.Node.Binding.attrib"/>
  </define>
  <define name="xforms.copy.content">
    <empty/>
  </define>
  <define name="xforms.filename">
    <element name="filename">
      <ref name="xforms.filename.attrib"/>
      <ref name="xforms.filename.content"/>
    </element>
  </define>
  <define name="xforms.filename.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <ref name="xforms.Single.Node.Binding.attrib"/>
  </define>
  <define name="xforms.filename.content">
    <empty/>
  </define>
  <define name="xforms.mediatype">
    <element name="mediatype">
      <ref name="xforms.mediatype.attrib"/>
      <ref name="xforms.mediatype.content"/>
    </element>
  </define>
  <define name="xforms.mediatype.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <ref name="xforms.Single.Node.Binding.attrib"/>
  </define>
  <define name="xforms.mediatype.content">
    <empty/>
  </define>
  <define name="xforms.output">
    <element name="output">
      <ref name="xforms.output.attrib"/>
      <ref name="xforms.output.content"/>
    </element>
  </define>
  <define name="xforms.output.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <ref name="UI.xforms.Common.attrib"/>
    <optional>
      <ref name="xforms.Single.Node.Binding.attrib"/>
    </optional>
    <optional>
      <attribute name="mediatype"/>
    </optional>
    <optional>
      <attribute name="value">
        <ref name="XPathExpression"/>
      </attribute>
    </optional>
  </define>
  <define name="xforms.output.content">
    <optional>
      <ref name="xforms.label"/>
    </optional>
  </define>
  <define name="xforms.input">
    <element name="input">
      <ref name="xforms.input.attrib"/>
      <ref name="xforms.input.content"/>
    </element>
  </define>
  <define name="xforms.input.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <ref name="xforms.Single.Node.Binding.attrib"/>
    <optional>
      <attribute name="inputmode"/>
    </optional>
    <ref name="UI.xforms.Common.attrib"/>
    <optional>
      <attribute name="incremental">
        <data type="boolean"/>
      </attribute>
    </optional>
  </define>
  <define name="xforms.input.content">
    <ref name="xforms.label"/>
    <ref name="xforms.UI.Common.content"/>
  </define>
  <define name="xforms.textarea">
    <element name="textarea">
      <ref name="xforms.textarea.attrib"/>
      <ref name="xforms.textarea.content"/>
    </element>
  </define>
  <define name="xforms.textarea.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <ref name="xforms.Single.Node.Binding.attrib"/>
    <optional>
      <attribute name="inputmode"/>
    </optional>
    <ref name="UI.xforms.Common.attrib"/>
    <optional>
      <attribute name="incremental">
        <data type="boolean"/>
      </attribute>
    </optional>
  </define>
  <define name="xforms.textarea.content">
    <ref name="xforms.label"/>
    <ref name="xforms.UI.Common.content"/>
  </define>
  <define name="xforms.secret">
    <element name="secret">
      <ref name="xforms.secret.attrib"/>
      <ref name="xforms.secret.content"/>
    </element>
  </define>
  <define name="xforms.secret.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <ref name="xforms.Single.Node.Binding.attrib"/>
    <optional>
      <attribute name="inputmode"/>
    </optional>
    <ref name="UI.xforms.Common.attrib"/>
    <optional>
      <attribute name="incremental">
        <data type="boolean"/>
      </attribute>
    </optional>
  </define>
  <define name="xforms.secret.content">
    <ref name="xforms.label"/>
    <ref name="xforms.UI.Common.content"/>
  </define>
  <define name="xforms.upload">
    <element name="upload">
      <ref name="xforms.upload.attrib"/>
      <ref name="xforms.upload.content"/>
    </element>
  </define>
  <define name="xforms.upload.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <ref name="xforms.Single.Node.Binding.attrib"/>
    <optional>
      <attribute name="mediatype"/>
    </optional>
    <ref name="UI.xforms.Common.attrib"/>
    <optional>
      <attribute name="incremental">
        <data type="boolean"/>
      </attribute>
    </optional>
  </define>
  <define name="xforms.upload.content">
    <ref name="xforms.label"/>
    <optional>
      <ref name="xforms.filename"/>
    </optional>
    <optional>
      <ref name="xforms.mediatype"/>
    </optional>
    <ref name="xforms.UI.Common.content"/>
  </define>
  <define name="xforms.select1">
    <element name="select1">
      <ref name="xforms.select1.attrib"/>
      <ref name="xforms.select1.content"/>
    </element>
  </define>
  <define name="xforms.select1.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <ref name="xforms.Single.Node.Binding.attrib"/>
    <ref name="UI.xforms.Common.attrib"/>
    <optional>
      <attribute name="selection">
        <choice>
          <value>open</value>
          <value>closed</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="incremental">
        <data type="boolean"/>
      </attribute>
    </optional>  
  </define>
  <define name="xforms.select1.content">
    <ref name="xforms.label"/>
    <ref name="xforms.UI.Common.content"/>
    <ref name="xforms.List.UI.Common.content"/>
  </define>
  <define name="xforms.select">
    <element name="select">
      <ref name="xforms.select.attrib"/>
      <ref name="xforms.select.content"/>
    </element>
  </define>
  <define name="xforms.select.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <ref name="xforms.Single.Node.Binding.attrib"/>
    <ref name="UI.xforms.Common.attrib"/>
    <optional>
      <attribute name="selection">
        <choice>
          <value>open</value>
          <value>closed</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="incremental">
        <data type="boolean"/>
      </attribute>
    </optional>
  </define>
  <define name="xforms.select.content">
    <ref name="xforms.label"/>
    <ref name="xforms.UI.Common.content"/>
    <ref name="xforms.List.UI.Common.content"/>
  </define>
  <define name="xforms.range">
    <element name="range">
      <ref name="xforms.range.attrib"/>
      <ref name="xforms.range.content"/>
    </element>
  </define>
  <define name="xforms.range.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <ref name="xforms.Single.Node.Binding.attrib"/>
    <ref name="UI.xforms.Common.attrib"/>
    <optional>
      <attribute name="start"/>
    </optional>
    <optional>
      <attribute name="end"/>
    </optional>
    <optional>
      <attribute name="step"/>
    </optional>
    <optional>
      <attribute name="incremental">
        <data type="boolean"/>
      </attribute>
    </optional>
  </define>
  <define name="xforms.range.content">
    <ref name="xforms.label"/>
    <ref name="xforms.UI.Common.content"/>
  </define>
  <define name="xforms.trigger">
    <element name="trigger">
      <ref name="xforms.trigger.attrib"/>
      <ref name="xforms.trigger.content"/>
    </element>
  </define>
  <define name="xforms.trigger.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <optional>
      <ref name="xforms.Single.Node.Binding.attrib"/>
    </optional>
    <optional>
      <ref name="UI.xforms.Common.attrib"/>
    </optional>
  </define>
  <define name="xforms.trigger.content">
    <ref name="xforms.label"/>
    <ref name="xforms.UI.Common.content"/>
  </define>
  <define name="xforms.submit">
    <element name="submit">
      <ref name="xforms.submit.attrib"/>
      <ref name="xforms.submit.content"/>
    </element>
  </define>
  <define name="xforms.submit.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <attribute name="submission">
      <data type="IDREF"/>
    </attribute>
    <optional>
      <ref name="xforms.Single.Node.Binding.attrib"/>
    </optional>
    <optional>
      <ref name="UI.xforms.Common.attrib"/>
    </optional>
  </define>
  <define name="xforms.submit.content">
    <ref name="xforms.label"/>
    <ref name="xforms.UI.Common.content"/>
  </define>
  <!-- Actions -->
  <define name="xforms.action">
    <element name="action">
      <ref name="xforms.action.attrib"/>
      <ref name="xforms.action.content"/>
    </element>
  </define>
  <define name="xforms.action.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <ref name="xforms.actions.attrib"/>
  </define>
  <define name="xforms.action.content">
    <ref name="xforms.Actions"/>
  </define>
  <define name="xforms.dispatch">
    <element name="dispatch">
      <ref name="xforms.dispatch.attrib"/>
      <ref name="xforms.dispatch.content"/>
    </element>
  </define>
  <define name="xforms.dispatch.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <choice>
      <attribute name="name">
        <ref name="xforms.ActionName"/>
      </attribute>
      <element name="name">
        <ref name="xforms.ValueTemplate"/>
      </element>
    </choice>
    <choice>
      <!-- TODO collides with xhtml2-hypertext (xhtml.Common.attrib)
      <attribute name="target">
        <data type="IDREF"/>
      </attribute>
      -->
      <element name="target">
        <ref name="xforms.ValueTemplate"/>
      </element>
    </choice>
    <choice>
      <attribute name="delay">
        <data type="string"/>
      </attribute>
      <element name="delay">
        <ref name="xforms.ValueTemplate"/>
      </element>
    </choice>
    <optional>
      <attribute name="bubbles">
        <data type="boolean"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="cancelable">
        <data type="boolean"/>
      </attribute>
    </optional>
    <ref name="xforms.actions.attrib"/>
  </define>
  <define name="xforms.dispatch.content">
    <empty/>
  </define>
  <define name="xforms.rebuild">
    <element name="rebuild">
      <ref name="xforms.rebuild.attrib"/>
      <ref name="xforms.rebuild.content"/>
    </element>
  </define>
  <define name="xforms.rebuild.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <optional>
      <attribute name="model">
        <data type="IDREF"/>
      </attribute>
    </optional>
    <ref name="xforms.actions.attrib"/>
  </define>
  <define name="xforms.rebuild.content">
    <empty/>
  </define>
  <define name="xforms.revalidate">
    <element name="revalidate">
      <ref name="xforms.revalidate.attrib"/>
      <ref name="xforms.revalidate.content"/>
    </element>
  </define>
  <define name="xforms.revalidate.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <optional>
      <attribute name="model">
        <data type="IDREF"/>
      </attribute>
    </optional>
    <ref name="xforms.actions.attrib"/>
  </define>
  <define name="xforms.revalidate.content">
    <empty/>
  </define>
  <define name="xforms.recalculate">
    <element name="recalculate">
      <ref name="xforms.recalculate.attrib"/>
      <ref name="xforms.recalculate.content"/>
    </element>
  </define>
  <define name="xforms.recalculate.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <optional>
      <attribute name="model">
        <data type="IDREF"/>
      </attribute>
    </optional>
    <ref name="xforms.actions.attrib"/>
  </define>
  <define name="xforms.recalculate.content">
    <empty/>
  </define>
  <define name="xforms.refresh">
    <element name="refresh">
      <ref name="xforms.refresh.attrib"/>
      <ref name="xforms.refresh.content"/>
    </element>
  </define>
  <define name="xforms.refresh.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <optional>
      <attribute name="model">
        <data type="IDREF"/>
      </attribute>
    </optional>
    <ref name="xforms.actions.attrib"/>
  </define>
  <define name="xforms.refresh.content">
    <empty/>
  </define>
  <define name="xforms.setfocus">
    <element name="setfocus">
      <ref name="xforms.setfocus.attrib"/>
      <ref name="xforms.setfocus.content"/>
    </element>
  </define>
  <define name="xforms.setfocus.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <choice>
      <attribute name="control">
        <data type="IDREF"/>
      </attribute>
      <element name="control">
        <ref name="xforms.ValueTemplate"/>
      </element>
    </choice>
    <ref name="xforms.actions.attrib"/>
  </define>
  <define name="xforms.setfocus.content">
    <empty/>
  </define>
  <define name="xforms.load">
    <element name="load">
      <ref name="xforms.load.attrib"/>
      <ref name="xforms.load.content"/>
    </element>
  </define>
  <define name="xforms.load.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <choice>
      <!-- TODO collides with rdf/a resource attribute
      <attribute name="resource">
        <data type="anyURI"/>
      </attribute>
      -->
      <element name="resource">
        <ref name="xforms.ValueTemplate"/>
      </element>
    </choice>
    <optional>
      <attribute name="show">
        <choice>
          <value>new</value>
          <value>replace</value>
        </choice>
      </attribute>
    </optional>
    <ref name="xforms.Single.Node.Binding.attrib"/>
    <ref name="xforms.actions.attrib"/>
  </define>
  <define name="xforms.load.content">
    <empty/>
  </define>
  <define name="xforms.setvalue">
    <element name="setvalue">
      <ref name="xforms.setvalue.attrib"/>
      <ref name="xforms.setvalue.content"/>
    </element>
  </define>
  <define name="xforms.setvalue.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <optional>
      <ref name="xforms.Single.Node.Binding.attrib"/>
    </optional>
    <optional>
      <attribute name="value">
        <ref name="XPathExpression"/>
      </attribute>
    </optional>
    <ref name="xforms.actions.attrib"/>
  </define>
  <define name="xforms.setvalue.content">
    <text/>
  </define>
  <define name="xforms.send">
    <element name="send">
      <ref name="xforms.send.attrib"/>
      <ref name="xforms.send.content"/>
    </element>
  </define>
  <define name="xforms.send.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <attribute name="submission">
      <data type="IDREF"/>
    </attribute>
    <ref name="xforms.actions.attrib"/>
  </define>
  <define name="xforms.send.content">
    <empty/>
  </define>
  <define name="xforms.reset">
    <element name="reset">
      <ref name="xforms.reset.attrib"/>
      <ref name="xforms.reset.content"/>
    </element>
  </define>
  <define name="xforms.reset.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <optional>
      <attribute name="model">
        <data type="IDREF"/>
      </attribute>
    </optional>
    <ref name="xforms.actions.attrib"/>
  </define>
  <define name="xforms.reset.content">
    <empty/>
  </define>
  <define name="xforms.insert">
    <element name="insert">
      <ref name="xforms.insert.attrib"/>
      <ref name="xforms.insert.content"/>
    </element>
  </define>
  <define name="xforms.insert.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <attribute name="at">
      <ref name="XPathExpression"/>
    </attribute>
    <attribute name="position">
      <choice>
        <value>before</value>
        <value>after</value>
      </choice>
    </attribute>
    <optional>
      <ref name="xforms.Nodeset.Binding.attrib"/>
    </optional>
    <ref name="xforms.actions.attrib"/>
  </define>
  <define name="xforms.insert.content">
    <empty/>
  </define>
  <define name="xforms.delete">
    <element name="delete">
      <ref name="xforms.delete.attrib"/>
      <ref name="xforms.delete.content"/>
    </element>
  </define>
  <define name="xforms.delete.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <attribute name="at">
      <ref name="XPathExpression"/>
    </attribute>
    <optional>
      <ref name="xforms.Nodeset.Binding.attrib"/>
    </optional>
    <ref name="xforms.actions.attrib"/>
  </define>
  <define name="xforms.delete.content">
    <empty/>
  </define>
  <define name="xforms.setindex">
    <element name="setindex">
      <ref name="xforms.setindex.attrib"/>
      <ref name="xforms.setindex.content"/>
    </element>
  </define>
  <define name="xforms.setindex.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <attribute name="repeat">
      <data type="IDREF"/>
    </attribute>
    <attribute name="index">
      <ref name="XPathExpression"/>
    </attribute>
    <ref name="xforms.actions.attrib"/>
  </define>
  <define name="xforms.setindex.content">
    <empty/>
  </define>
  <define name="xforms.toggle">
    <element name="toggle">
      <ref name="xforms.toggle.attrib"/>
      <ref name="xforms.toggle.content"/>
    </element>
  </define>
  <define name="xforms.toggle.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <choice>
      <attribute name="case">
        <data type="IDREF"/>
      </attribute>
      <element name="case">
        <ref name="xforms.ValueTemplate"/>
      </element>
    </choice>
    <ref name="xforms.actions.attrib"/>
  </define>
  <define name="xforms.toggle.content">
    <empty/>
  </define>
  <define name="xforms.message">
    <element name="message">
      <ref name="xforms.message.attrib"/>
      <ref name="xforms.message.content"/>
    </element>
  </define>
  <define name="xforms.message.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <attribute name="level">
      <choice>
        <value>ephemeral</value>
        <value>modeless</value>
        <value>modal</value>
      </choice>
    </attribute>
    <optional>
      <ref name="xforms.Linking.attrib"/>
    </optional>
    <optional>
      <ref name="xforms.Single.Node.Binding.attrib"/>
    </optional>
    <ref name="xforms.actions.attrib"/>
  </define>
  <define name="xforms.message.content">
    <ref name="xforms.UI.Inline.content"/>
  </define>
  <define name="xforms.Actions">
    <zeroOrMore>
      <choice>
        <ref name="xforms.action"/>
        <ref name="xforms.dispatch"/>
        <ref name="xforms.rebuild"/>
        <ref name="xforms.recalculate"/>
        <ref name="xforms.refresh"/>
        <ref name="xforms.setfocus"/>
        <ref name="xforms.load"/>
        <ref name="xforms.setvalue"/>
        <ref name="xforms.send"/>
        <ref name="xforms.reset"/>
        <ref name="xforms.insert"/>
        <ref name="xforms.delete"/>
        <ref name="xforms.setindex"/>
        <ref name="xforms.toggle"/>
        <ref name="xforms.message"/>
      </choice>
    </zeroOrMore>
  </define>
  <!-- TODO: Do the XML Events attributes go only on actions? -->
  <define name="xforms.actions.attrib" combine="interleave">
    <ref name="xforms.Events.attrib"/>
    <optional>
      <attribute name="if">
        <ref name="xforms.ValueTemplate"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="while">
        <ref name="xforms.ValueTemplate"/>
      </attribute>
    </optional>
  </define>
  <!-- Container Form Controls -->
  <define name="xforms.Container.Form.Controls">
    <choice>
      <ref name="xforms.group"/>
      <ref name="xforms.repeat"/>
      <ref name="xforms.switch"/>
    </choice>
  </define>
  <define name="xforms.repeat">
    <element name="repeat">
      <ref name="xforms.repeat.attrib"/>
      <ref name="xforms.repeat.content"/>
    </element>
  </define>
  <define name="xforms.repeat.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <ref name="xforms.Nodeset.Binding.attrib"/>
    <ref name="UI.xforms.Common.attrib"/>
    <optional>
      <attribute name="startindex">
        <data type="positiveInteger"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="number">
        <data type="nonNegativeInteger"/>
      </attribute>
    </optional>
  </define>
  <define name="xforms.repeat.content">
    <zeroOrMore>
      <choice>
        <ref name="xforms.Core.Form.Controls"/>
        <ref name="xforms.Container.Form.Controls"/>
        <ref name="xforms.UI.Inline.content"/>
      </choice>
    </zeroOrMore>
  </define>
  <define name="xforms.group">
    <element name="group">
      <ref name="xforms.group.attrib"/>
      <ref name="xforms.group.content"/>
    </element>
  </define>
  <define name="xforms.group.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <optional>
      <ref name="xforms.Single.Node.Binding.attrib"/>
    </optional>
    <ref name="UI.xforms.Common.attrib"/>
  </define>
  <define name="xforms.group.content">
    <optional>
      <ref name="xforms.label"/>
    </optional>
    <zeroOrMore>
      <choice>
        <ref name="xforms.Core.Form.Controls"/>
        <ref name="xforms.Container.Form.Controls"/>
        <ref name="xforms.UI.Common.content"/>
        <ref name="xforms.UI.Inline.content"/>
      </choice>
    </zeroOrMore>
  </define>
  <define name="xforms.switch">
    <element name="switch">
      <ref name="xforms.switch.attrib"/>
      <ref name="xforms.switch.content"/>
    </element>
  </define>
  <define name="xforms.switch.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
    <optional>
      <ref name="xforms.Single.Node.Binding.attrib"/>
    </optional>
    <ref name="UI.xforms.Common.attrib"/>
  </define>
  <define name="xforms.switch.content">
    <oneOrMore>
      <ref name="xforms.case"/>
    </oneOrMore>
  </define>
  <define name="xforms.case">
    <element name="case">
      <ref name="xforms.case.attrib"/>
      <ref name="xforms.case.content"/>
    </element>
  </define>
  <define name="xforms.case.attrib" combine="interleave">
    <ref name="xforms.Common.attrib"/>
  </define>
  <define name="xforms.case.content">
    <optional>
      <ref name="xforms.label"/>
    </optional>
    <zeroOrMore>
      <choice>
        <ref name="xforms.Core.Form.Controls"/>
        <ref name="xforms.Container.Form.Controls"/>
        <ref name="xforms.action"/>
        <ref name="xforms.UI.Inline.content"/>
      </choice>
    </zeroOrMore>
  </define>
  <!-- Simple Types -->
  <define name="QNameButNotNCName">
    <data type="QName">
      <param name="pattern">[^:]+:[^:]+</param>
    </data>
  </define>
  <define name="XPathExpression">
    <data type="string"/>
  </define>
  <define name="xforms.ValueTemplate">
    <ref name="XPathExpression"/>
  </define>
  <!-- Actions -->
  <define name="xforms.ActionName">
    <choice>
      <value>xforms-model-construct</value>
      <value>xforms-model-construct-done</value>
      <value>xforms-ready</value>
      <value>xforms-model-destruct</value>
      <value>xforms-rebuild</value>
      <value>xforms-recalculate</value>
      <value>xforms-revalidate</value>
      <value>xforms-refresh</value>
      <value>xforms-reset</value>
      <value>xforms-previous</value>
      <value>xforms-next</value>
      <value>xforms-focus</value>
      <value>xforms-help</value>
      <value>xforms-hint</value>
      <value>xforms-submit</value>
      <value>xforms-submit-serialize</value>
      <value>xforms-insert</value>
      <value>xforms-delete</value>
      <value>xforms-value-changed</value>
      <value>xforms-valid</value>
      <value>xforms-invalid</value>
      <value>xforms-readonly</value>
      <value>xforms-readwrite</value>
      <value>xforms-required</value>
      <value>xforms-optional</value>
      <value>xforms-enabled</value>
      <value>xforms-disabled</value>
      <value>xforms-select</value>
      <value>xforms-deselect</value>
      <value>xforms-in-range</value>
      <value>xforms-out-of-range</value>
      <value>xforms-scroll-first</value>
      <value>xforms-scroll-last</value>
      <value>xforms-submit-done</value>
      <value>xforms-binding-exception</value>
      <value>xforms-compute-exception</value>
      <value>xforms-link-error</value>
      <value>xforms-link-exception</value>
      <value>xforms-output-error</value>
      <value>xforms-submit-error</value>
      <value>xforms-version-exception</value>
      <data type="NMTOKEN">
        <except>
          <data type="NMTOKEN">
            <param name="pattern">^xforms-.*</param>
          </data>
        </except>
      </data>
    </choice>
  </define>
  <define name="anyElement">
    <element>
      <anyName/>
      <zeroOrMore>
        <choice>
          <attribute>
            <anyName/>
          </attribute>
          <text/>
          <ref name="anyElement"/>
        </choice>
      </zeroOrMore>
    </element>
  </define>
</grammar>

C.4.8. XForms Repeat Attribute Collection

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>XForms Repeat Attribute Collection Module</x:h1>
  <define name="xforms.Repeat.attrib">
    <optional>
      <attribute name="repeat-model">
        <ref name="IDREF.datatype"/>
      </attribute>
    </optional>    
    <optional>
      <attribute name="repeat-bind">
        <ref name="IDREF.datatype"/>
      </attribute>
    </optional>    
    <optional>
      <attribute name="repeat-nodeset">
        <ref name="LocationPath.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="repeat-startindex">
        <ref name="Number.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="repeat-number">
        <ref name="Number.datatype"/>
      </attribute>
    </optional>
  </define>
</grammar>