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="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="Common.extra.attrib">
    <empty/>
  </define>
  <define name="Common.attrib">
    <ref name="Common.extra.attrib"/>
  </define>
  <define name="CommonNoEvents.attrib" combine="interleave">
    <ref name="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="html"/>
  </start>
  <div>
    <x:h2>The html element</x:h2>
    <define name="html">
      <element name="html">
        <ref name="html.attlist"/>
        <ref name="head"/>
        <ref name="body"/>
      </element>
    </define>
    <define name="html.attlist">
      <ref name="Common.attrib"/>
      <ref name="version.attrib"/>
    </define>
    <define name="version.attrib">
      <optional>
        <attribute name="version">
          <ref name="CDATA.datatype"/>
        </attribute>     
      </optional>
    </define>
  </div>
  <div>
    <x:h2>The head element</x:h2>
    <define name="head">
      <element name="head">
        <ref name="head.attlist"/>
        <ref name="head.content"/>
      </element>
    </define>
    <define name="head.attlist">
      <ref name="Common.attrib"/>
    </define>
    <define name="head.content">
      <ref name="title"/>
      <zeroOrMore>
        <choice>
          <ref name="head.misc"/>
        </choice>
      </zeroOrMore>
    </define>
    <define name="head.misc">
      <notAllowed/>
    </define>
  </div>
  <div>
    <x:h2>The title element</x:h2>
    <define name="title">
      <element name="title">
        <ref name="title.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="title.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The body element</x:h2>
    <define name="body">
      <element name="body">
        <ref name="body.attlist"/>
        <ref name="Structural.model"/>
      </element>
    </define>
    <define name="body.attlist">
      <ref name="Common.attrib"/>
    </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="address">
      <element name="address">
        <ref name="address.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="address.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The blockcode element</x:h2>
    <define name="blockcode">
      <element name="blockcode">
        <ref name="blockcode.attlist"/>
        <ref name="blockcode.content"/>
      </element>
    </define>
    <define name="blockcode.attlist">
      <ref name="Common.attrib"/>
    </define>
    <define name="blockcode.content">
      <ref name="blockcode.model"/>
    </define>
  </div>
  <div>
    <x:h2>The blockquote element</x:h2>
    <define name="blockquote">
      <element name="blockquote">
        <ref name="blockquote.attlist"/>
        <ref name="blockquote.content"/>
      </element>
    </define>
    <define name="blockquote.attlist">
      <ref name="Common.attrib"/>
    </define>
    <define name="blockquote.content">
      <ref name="blockquote.model"/>
    </define>
  </div>
  <div>
    <x:h2>The div element</x:h2>
    <define name="div">
      <element name="div">
        <ref name="div.attlist"/>
        <ref name="Flow.model"/>
      </element>
    </define>
    <define name="div.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The heading elements</x:h2>
    <define name="h">
      <element name="h">
        <ref name="Heading.attlist"/>
        <ref name="Heading.content"/>
      </element>
    </define>
    <define name="h1">
      <element name="h1">
        <ref name="Heading.attlist"/>
        <ref name="Heading.content"/>
      </element>
    </define>
    <define name="h2">
      <element name="h2">
        <ref name="Heading.attlist"/>
        <ref name="Heading.content"/>
      </element>
    </define>
    <define name="h3">
      <element name="h3">
        <ref name="Heading.attlist"/>
        <ref name="Heading.content"/>
      </element>
    </define>
    <define name="h4">
      <element name="h4">
        <ref name="Heading.attlist"/>
        <ref name="Heading.content"/>
      </element>
    </define>
    <define name="h5">
      <element name="h5">
        <ref name="Heading.attlist"/>
        <ref name="Heading.content"/>
      </element>
    </define>
    <define name="h6">
      <element name="h6">
        <ref name="Heading.attlist"/>
        <ref name="Heading.content"/>
      </element>
    </define>
    <define name="Heading.attlist">
      <ref name="Common.attrib"/>
    </define>
    <define name="Heading.content">
      <ref name="Text.model"/>
    </define>
  </div>
  <div>
    <x:h2>The p element</x:h2>
    <define name="p">
      <element name="p">
        <ref name="p.attlist"/>
        <ref name="p.content"/>
      </element>
    </define>
    <define name="p.attlist">
      <ref name="Common.attrib"/>
    </define>
    <define name="p.content">
      <ref name="p.model"/>
    </define>
  </div>
  <div>
    <x:h2>The pre element</x:h2>
    <define name="pre">
      <element name="pre">
        <ref name="pre.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="pre.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The section element</x:h2>
    <define name="section">
      <element name="section">
        <ref name="section.attlist"/>
        <ref name="Flow.model"/>
      </element>
    </define>
    <define name="section.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The separator element</x:h2>
    <define name="separator">
      <element name="separator">
        <ref name="separator.attlist"/>
      </element>
    </define>
    <define name="separator.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>Content Model</x:h2>
    <define name="Heading.class">
      <choice>
        <ref name="h"/>
        <ref name="h1"/>
        <ref name="h2"/>
        <ref name="h3"/>
        <ref name="h4"/>
        <ref name="h5"/>
        <ref name="h6"/>
      </choice>
    </define>
    <define name="Structural.class">
      <choice>
        <ref name="address"/>
        <ref name="blockcode"/>
        <ref name="blockquote"/>
        <ref name="div"/>
        <!--ref name="List.class"/-->
        <ref name="p"/>
        <ref name="pre"/>
        <ref name="section"/>
        <ref name="separator"/>
      </choice>
    </define>
    <define name="blockcode.model">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="Text.class"/>
          <ref name="Heading.class"/>
          <ref name="Structural.class"/>
          <ref name="List.class"/>
          <ref name="Misc.class"/>
        </choice>
      </zeroOrMore>
    </define>
    <define name="blockquote.model">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="Text.class"/>
          <ref name="Heading.class"/>
          <ref name="Structural.class"/>
          <ref name="List.class"/>
          <ref name="Misc.class"/>
        </choice>
      </zeroOrMore>
    </define>
    <define name="p.model">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="Text.class"/>
          <ref name="List.class"/>
          <ref name="blockcode"/>
          <ref name="blockquote"/>
          <ref name="pre"/>
          <ref name="table"/>
          <ref name="Misc.class"/>
        </choice>
      </zeroOrMore>
    </define>
    <define name="Structural.mix">
      <zeroOrMore>
        <choice>
          <ref name="Heading.class"/>
          <ref name="Structural.class"/>
          <ref name="List.class"/>
          <ref name="Misc.class"/>
        </choice>
      </zeroOrMore>
    </define>
    <define name="Structural.model">
      <oneOrMore>
        <ref name="Structural.mix"/>
      </oneOrMore>
    </define>
    <define name="Flow.model">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="Heading.class"/>
          <ref name="Structural.class"/>
          <ref name="List.class"/>
          <ref name="Text.class"/>
          <ref name="Misc.class"/>
        </choice>
      </zeroOrMore>
    </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="abbr">
      <element name="abbr">
        <ref name="abbr.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="abbr.attlist">
      <ref name="Common.attrib"/>
      <optional>
        <attribute name="full">
          <ref name="URI.datatype"/>
        </attribute>
      </optional>
    </define>
  </div>
  <div>
    <x:h2>The cite element</x:h2>
    <define name="cite">
      <element name="cite">
        <ref name="cite.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="cite.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The code element</x:h2>
    <define name="code">
      <element name="code">
        <ref name="code.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="code.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The dfn element</x:h2>
    <define name="dfn">
      <element name="dfn">
        <ref name="dfn.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="dfn.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The em element</x:h2>
    <define name="em">
      <element name="em">
        <ref name="em.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="em.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The kbd element</x:h2>
    <define name="kbd">
      <element name="kbd">
        <ref name="kbd.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="kbd.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The l element</x:h2>
    <define name="l">
      <element name="l">
        <ref name="l.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="l.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The quote element</x:h2>
    <define name="quote">
      <element name="quote">
        <ref name="quote.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="quote.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The samp element</x:h2>
    <define name="samp">
      <element name="samp">
        <ref name="samp.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="samp.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The span element</x:h2>
    <define name="span">
      <element name="span">
        <ref name="span.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="span.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The strong element</x:h2>
    <define name="strong">
      <element name="strong">
        <ref name="strong.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="strong.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The sub element</x:h2>
    <define name="sub">
      <element name="sub">
        <ref name="sub.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="sub.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The sup element</x:h2>
    <define name="sup">
      <element name="sup">
        <ref name="sup.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="sup.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The var element</x:h2>
    <define name="var">
      <element name="var">
        <ref name="var.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="var.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:p>these can occur at Structural or Text level</x:p>
    <define name="Misc.class">
      <empty/>
    </define>
  </div>
  <div>
    <x:h2>Content Model</x:h2>
    <define name="Text.class">
      <choice>
        <ref name="abbr"/>
        <ref name="cite"/>
        <ref name="code"/>
        <ref name="dfn"/>
        <ref name="em"/>
        <ref name="kbd"/>
        <ref name="l"/>
        <ref name="quote"/>
        <ref name="samp"/>
        <ref name="span"/>
        <ref name="strong"/>
        <ref name="sub"/>
        <ref name="sup"/>
        <ref name="var"/>
      </choice>
    </define>
    <define name="Text.model">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="Text.class"/>
          <ref name="Misc.class"/>
        </choice>
      </zeroOrMore>
    </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="a">
      <element name="a">
        <ref name="a.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="a.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <define name="Text.class" combine="choice">
    <ref name="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="dl">
      <element name="dl">
        <ref name="dl.attlist"/>
        <optional>
          <ref name="caption"/>
        </optional>
        <choice>
          <oneOrMore>
            <choice>
              <ref name="dt"/>
              <ref name="dd"/>
            </choice>
          </oneOrMore>
          <oneOrMore>
            <ref name="di"/>
          </oneOrMore>
        </choice>
      </element>
    </define>
    <define name="dl.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The di element</x:h2>
    <define name="di">
      <element name="di">
        <ref name="di.attlist"/>
        <oneOrMore>
          <ref name="dt"/>
        </oneOrMore>
        <zeroOrMore>
          <ref name="dd"/>
        </zeroOrMore>
      </element>
    </define>
    <define name="di.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The dt element</x:h2>
    <define name="dt">
      <element name="dt">
        <ref name="dt.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="dt.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The dd element</x:h2>
    <define name="dd">
      <element name="dd">
        <ref name="dd.attlist"/>
        <ref name="Flow.model"/>
      </element>
    </define>
    <define name="dd.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The nl element</x:h2>
    <define name="nl">
      <element name="nl">
        <ref name="nl.attlist"/>
        <ref name="caption"/>
        <oneOrMore>
          <ref name="li"/>
        </oneOrMore>
      </element>
    </define>
    <define name="nl.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The ol element</x:h2>
    <define name="ol">
      <element name="ol">
        <ref name="ol.attlist"/>
        <optional>
          <ref name="caption"/>
        </optional>
        <oneOrMore>
          <ref name="li-in-ol"/>
        </oneOrMore>
      </element>
    </define>
    <define name="ol.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The ul element</x:h2>
    <define name="ul">
      <element name="ul">
        <ref name="ul.attlist"/>
        <optional>
          <ref name="caption"/>
        </optional>
        <oneOrMore>
          <ref name="li"/>
        </oneOrMore>
      </element>
    </define>
    <define name="ul.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The li element</x:h2>
    <define name="li">
      <element name="li">
        <ref name="li.attlist"/>
        <ref name="Flow.model"/>
      </element>
    </define>  
    <define name="li.attlist">
      <ref name="Common.attrib"/>
    </define>
    <define name="li-in-ol">
      <element name="li">
        <ref name="li-in-ol.attlist"/>
        <ref name="Flow.model"/>
      </element>
    </define>  
    <define name="li-in-ol.attlist">
      <ref name="Common.attrib"/>
      <ref name="value.attrib"/>
    </define>
    <define name="value.attrib">
      <optional>
        <attribute name="value">
          <ref name="Number.datatype"/>
        </attribute>
      </optional>
    </define>
  </div>
  <div>
    <x:h2>List Content Set</x:h2>
    <define name="List.class">
      <choice>
        <ref name="dl"/>
        <ref name="nl"/>
        <ref name="ol"/>
        <ref name="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:a="http://relaxng.org/ns/compatibility/annotations/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="class.attrib">
      <optional>
        <attribute name="class">
          <ref name="NMTOKENS.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="id.attrib">
      <optional>
      	<choice>
          <attribute name="xml:id">
            <ref name="ID.datatype"/>
          </attribute>
          <attribute name="id">
            <ref name="ID.datatype"/>
          </attribute>          
        </choice>
      </optional>
    </define>
    <define name="layout.attrib">
      <optional>
        <attribute name="layout" a:defaultValue="irrelevant">
          <choice>
            <value>irrelevant</value>  
            <value>relevant</value>  
          </choice>
        </attribute>
      </optional>
    </define>
    <define name="title.attrib">
      <optional>
        <attribute name="title">
          <ref name="Text.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="Core.attrib">
      <ref name="id.attrib"/>
      <ref name="class.attrib"/>
      <ref name="layout.attrib"/>
      <ref name="title.attrib"/>
    </define>
  </div>
  <define name="Common.attrib" combine="interleave">
    <ref name="Core.attrib"/>
  </define>
  <define name="CommonNoEvents.attrib" combine="interleave">
    <ref name="Core.attrib"/>
  </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="cite.attrib">
      <optional>
        <attribute name="cite">
          <ref name="URI.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="href.attrib">
      <optional>
        <attribute name="href">
          <ref name="URI.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="hreflang.attrib">
      <optional>
        <attribute name="hreflang">
          <ref name="LanguageCodes.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="hrefmedia.attrib">
      <optional>
        <attribute name="hrefmedia">
          <ref name="MediaDesc.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="hreftype.attrib">
      <optional>
        <attribute name="hreftype">
          <ref name="ContentTypes.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="nextfocus.attrib">
      <optional>
        <attribute name="nextfocus">
          <ref name="IDREF.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="prevfocus.attrib">
      <optional>
        <attribute name="prevfocus">
          <ref name="IDREF.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="target.attrib">
      <optional>
        <attribute name="target">
          <ref name="HrefTarget.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="base.attrib">
      <optional>
        <attribute name="xml:base">
          <ref name="URI.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="Hypertext.attrib">
      <ref name="cite.attrib"/>
      <ref name="href.attrib"/>
      <ref name="hreflang.attrib"/>
      <ref name="hrefmedia.attrib"/>
      <ref name="hreftype.attrib"/>
      <ref name="nextfocus.attrib"/>
      <ref name="prevfocus.attrib"/>
      <ref name="target.attrib"/>
      <ref name="base.attrib"/>
    </define>
  </div>
  <define name="Common.attrib" combine="interleave">
    <ref name="Hypertext.attrib"/>
  </define>
  <define name="CommonNoEvents.attrib" combine="interleave">
    <ref name="Hypertext.attrib"/>
  </define>
</grammar>

C.1.9. I18N 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>I18N Attribute Module</x:h1>
  <div>
    <x:h2>I18N Attribute Collection</x:h2>
    <define name="lang.attrib">
      <optional>
        <attribute name="xml:lang">
          <ref name="LanguageCode.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="I18n.attrib">
      <ref name="lang.attrib"/>
    </define>
  </div>
  <define name="Common.attrib" combine="interleave">
    <ref name="I18n.attrib"/>
  </define>
  <define name="CommonNoEvents.attrib" combine="interleave">
    <ref name="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"
         xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0">
  <x:h1>Access Module</x:h1>
  <div>
    <x:h2>The access element</x:h2>
    <define name="access">
      <element name="access">
        <ref name="access.attlist"/>
      </element>
    </define>
    <define name="access.attlist">
      <ref name="Common.attrib"/>
      <optional>
        <attribute name="activate" a:defaultValue="false">
          <choice>
            <value>true</value>
            <value>false</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="key">
          <ref name="Characters.datatype"/>
        </attribute>
      </optional>   
      <optional>
        <attribute name="order" a:defaultValue="document">
          <choice>
            <value>document</value>
            <value>list</value>
          </choice>
        </attribute>
      </optional>         
      <optional>
        <attribute name="targetid">
          <ref name="IDREF.datatype"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="targetrole">
          <ref name="CURIEs.datatype"/>
        </attribute>
      </optional>
    </define>
  </div>
  <define name="head.misc" combine="choice">
    <ref name="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:a="http://relaxng.org/ns/compatibility/annotations/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="dir.attrib">
      <optional>
        <attribute name="dir" a:defaultValue="ltr">
          <choice>
            <value>ltr</value>
            <value>rtl</value>
            <value>lro</value>
            <value>rlo</value>
          </choice>
        </attribute>
      </optional>
    </define>
    <define name="Bidi.attrib">
      <ref name="dir.attrib"/>
    </define>
  </div>
  <define name="Common.attrib" combine="interleave">
    <ref name="Bidi.attrib"/>
  </define>
  <define name="CommonNoEvents.attrib" combine="interleave">
    <ref name="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="edit.attrib">
      <optional>
        <attribute name="edit">
          <choice>
            <value>inserted</value>
            <value>deleted</value>
            <value>changed</value>
            <value>moved</value>
          </choice>
        </attribute>
      </optional>
    </define>
    <define name="datetime.attrib">
      <optional>
        <attribute name="datetime">
          <ref name="Datetime.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="Edit.attrib">
      <ref name="edit.attrib"/>
      <ref name="datetime.attrib"/>
    </define>
  </div>
  <define name="Common.attrib" combine="interleave">
    <ref name="Edit.attrib"/>
  </define>
  <define name="CommonNoEvents.attrib" combine="interleave">
    <ref name="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="src.attrib">
      <optional>
        <attribute name="src">
          <ref name="URI.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="srcencoding.attrib">
      <optional>
        <attribute name="srcencoding">
          <ref name="Encodings.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="srctype.attrib">
      <optional>
        <attribute name="srctype">
          <ref name="ContentTypes.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="Embedding.attrib">
      <ref name="src.attrib"/>
      <ref name="srcencoding.attrib"/>
      <ref name="srctype.attrib"/>
    </define>
  </div>
  <define name="Common.attrib" combine="interleave">
    <ref name="Embedding.attrib"/>
  </define>
  <define name="CommonNoEvents.attrib" combine="interleave">
    <ref name="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="img">
      <element name="img">
        <ref name="img.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="img.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <define name="Text.class" combine="choice">
    <ref name="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="usemap.attrib">
      <optional>
        <attribute name="usemap">
          <ref name="URI.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="ismap.attrib">
      <optional>
        <attribute name="ismap">
          <value>ismap</value>
        </attribute>
      </optional>
    </define>
    <define name="shape.attrib">
      <optional>
        <attribute name="shape">
          <ref name="Shape.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="coords.attrib">
      <optional>
        <attribute name="coords">
          <ref name="Coordinates.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="Map.attrib">
      <ref name="usemap.attrib"/>
      <ref name="ismap.attrib"/>
      <ref name="shape.attrib"/>
      <ref name="coords.attrib"/>
    </define>
  </div>
  <define name="Common.attrib" combine="interleave">
    <ref name="Map.attrib"/>
  </define>
  <define name="CommonNoEvents.attrib" combine="interleave">
    <ref name="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:a="http://relaxng.org/ns/compatibility/annotations/1.0"
         xmlns:x="http://www.w3.org/1999/xhtml">
  <x:h1>Media Attribute Module</x:h1>
  <define name="media.attrib">
    <optional>
      <attribute name="media" a:defaultValue="all">
        <ref name="MediaDesc.datatype"/>
      </attribute>
    </optional>
  </define>
  <define name="Common.attrib" combine="interleave">
    <ref name="media.attrib"/>
  </define>
  <define name="CommonNoEvents.attrib" combine="interleave">
    <ref name="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:a="http://relaxng.org/ns/compatibility/annotations/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="about.attrib">
      <optional>
        <attribute name="about">
          <ref name="URIorSafeCURIE.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="content.attrib">
      <optional>
        <attribute name="content">
          <ref name="CDATA.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="datatype.attrib">
      <optional>
        <attribute name="datatype">
          <ref name="CURIE.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="typeof.attrib">
      <optional>
        <attribute name="typeof">
          <ref name="CURIEs.datatype"/>
        </attribute>
      </optional>
    </define>    
    <define name="property.attrib">
      <optional>
        <attribute name="property" a:defaultValue="reference">
          <ref name="CURIEs.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="rel.attrib">
      <optional>
        <attribute name="rel">
          <ref name="CURIEs.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="resource.attrib">
      <optional>
        <attribute name="resource">
          <ref name="URIorSafeCURIE.datatype"/>
        </attribute>
      </optional>
    </define>    
    <define name="rev.attrib">
      <optional>
        <attribute name="rev">
          <ref name="CURIEs.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="Metadata.attrib">
      <ref name="about.attrib"/>
      <ref name="content.attrib"/>
      <ref name="datatype.attrib"/>
      <ref name="typeof.attrib"/>
      <ref name="property.attrib"/>
      <ref name="rel.attrib"/>
      <ref name="resource.attrib"/>
      <ref name="rev.attrib"/>
    </define>
  </div>
  <define name="Common.attrib" combine="interleave">
    <ref name="Metadata.attrib"/>
  </define>
  <define name="CommonNoEvents.attrib" combine="interleave">
    <ref name="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="link">
      <element name="link">
        <ref name="link.attlist"/>
        <zeroOrMore>
          <choice>
            <ref name="link"/>
            <ref name="meta"/>
          </choice>
        </zeroOrMore>
      </element>
    </define>
    <define name="link.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <define name="head.misc" combine="choice">
    <ref name="link"/>
  </define>
  <define name="Misc.class" combine="choice">
    <ref name="link"/>
  </define>
  <div>
    <x:h2>The meta element</x:h2>
    <define name="meta">
      <element name="meta">
        <ref name="meta.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="meta.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <define name="head.misc" combine="choice">
    <ref name="meta"/>
  </define>
  <define name="Misc.class" combine="choice">
    <ref name="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="object">
      <element name="object">
        <ref name="object.attlist"/>
        <optional>
          <ref name="caption"/>
        </optional>
        <optional>
          <ref name="standby"/>
        </optional>
        <zeroOrMore>
          <ref name="param"/>
        </zeroOrMore>
        <ref name="Flow.model"/>
      </element>
    </define>
    <define name="object.attlist">
      <ref name="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>
  </div>
  <div>
    <x:h2>The standby element</x:h2>
    <define name="standby">
      <element name="standby">
        <ref name="standby.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>
    <define name="standby.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <define name="Text.class" combine="choice">
    <ref name="object"/>
  </define>
</grammar>

C.1.20. Role 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"
         xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0">
  <x:h1>Access Module</x:h1>
  <div>
    <x:h2>The access element</x:h2>
    <define name="access">
      <element name="access">
        <ref name="access.attlist"/>
      </element>
    </define>
    <define name="access.attlist">
      <ref name="Common.attrib"/>
      <optional>
        <attribute name="activate" a:defaultValue="false">
          <choice>
            <value>true</value>
            <value>false</value>
          </choice>
        </attribute>
      </optional>
      <optional>
        <attribute name="key">
          <ref name="Characters.datatype"/>
        </attribute>
      </optional>   
      <optional>
        <attribute name="order" a:defaultValue="document">
          <choice>
            <value>document</value>
            <value>list</value>
          </choice>
        </attribute>
      </optional>         
      <optional>
        <attribute name="targetid">
          <ref name="IDREF.datatype"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="targetrole">
          <ref name="CURIEs.datatype"/>
        </attribute>
      </optional>
    </define>
  </div>
  <define name="head.misc" combine="choice">
    <ref name="access"/>
  </define>
</grammar>

C.1.21. 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="style.attrib">
    <optional>
      <attribute name="style"/>
    </optional>
  </define>
  <define name="Common.attrib" combine="interleave">
    <ref name="style.attrib"/>
  </define>
  <define name="CommonNoEvents.attrib" combine="interleave">
    <ref name="style.attrib"/>
  </define>
</grammar>

C.1.22. 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="style">
      <element name="style">
        <ref name="style.attlist"/>
        <text/>
      </element>
    </define>
    <define name="style.attlist">
      <ref name="Common.attrib"/>
      <optional>
        <attribute name="disabled">
          <value>disabled</value>
        </attribute>     
      </optional>
    </define>
  </div>
  <define name="head.misc" combine="choice">
    <ref name="style"/>
  </define>
</grammar>

C.1.23. Tables

<?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>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="table">
      <element name="table">
        <ref name="table.attlist"/>
        <optional>
          <ref name="caption"/>
        </optional>
        <optional>
          <ref name="summary"/>
        </optional>
        <choice>
          <zeroOrMore>
            <ref name="col"/>
          </zeroOrMore>
          <zeroOrMore>
            <ref name="colgroup"/>
          </zeroOrMore>
        </choice>
        <choice>
          <group>
            <optional>
              <ref name="thead"/>
            </optional>
            <optional>
              <ref name="tfoot"/>
            </optional>
            <oneOrMore>
              <ref name="tbody"/>
            </oneOrMore>
          </group>
          <oneOrMore>
            <ref name="tr"/>
          </oneOrMore>
        </choice>
      </element>
    </define>
    <define name="table.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The summary element</x:h2>
    <define name="summary">
      <element name="summary">
        <ref name="summary.attlist"/>
        <ref name="Flow.model"/>
      </element>
    </define>
    <define name="summary.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The col element</x:h2>
    <define name="col">
      <element name="col">
        <ref name="col.attlist"/>
      </element>
    </define>
    <define name="col.attlist">
      <ref name="Common.attrib"/>
      <ref name="span.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The colgroup element</x:h2>
    <define name="colgroup">
      <element name="colgroup">
        <ref name="colgroup.attlist"/>
        <zeroOrMore>
          <ref name="col"/>
        </zeroOrMore>
      </element>
    </define>
    <define name="colgroup.attlist">
      <ref name="Common.attrib"/>
      <ref name="span.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The thead element</x:h2>
    <define name="thead">
      <element name="thead">
        <ref name="thead.attlist"/>
        <oneOrMore>
          <ref name="tr"/>
        </oneOrMore>
      </element>
    </define>
    <define name="thead.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The tfoot element</x:h2>
    <define name="tfoot">
      <element name="tfoot">
        <ref name="tfoot.attlist"/>
        <oneOrMore>
          <ref name="tr"/>
        </oneOrMore>
      </element>
    </define>
    <define name="tfoot.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The tbody element</x:h2>
    <define name="tbody">
      <element name="tbody">
        <ref name="tbody.attlist"/>
        <oneOrMore>
          <ref name="tr"/>
        </oneOrMore>
      </element>
    </define>
    <define name="tbody.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The tr element</x:h2>
    <define name="tr">
      <element name="tr">
        <ref name="tr.attlist"/>
        <oneOrMore>
          <choice>
            <ref name="th"/>
            <ref name="td"/>
          </choice>
        </oneOrMore>
      </element>
    </define>
    <define name="tr.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The th element</x:h2>
    <define name="th">
      <element name="th">
        <ref name="th.attlist"/>
        <ref name="Flow.model"/>
      </element>
    </define>
    <define name="th.attlist">
      <ref name="Cell.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>The td element</x:h2>
    <define name="td">
      <element name="td">
        <ref name="td.attlist"/>
        <ref name="Flow.model"/>
      </element>
    </define>
    <define name="td.attlist">
      <ref name="Cell.attrib"/>
    </define>
  </div>
  <div>
    <x:h2>Attribute definitions</x:h2>
    <define name="span.attrib">
      <optional>
        <attribute name="span" a:defaultValue="1">
          <ref name="spanNumber.datatype"/>
        </attribute>
      </optional>
    </define>
    <define name="Cell.attrib">
      <ref name="Common.attrib"/>
      <optional>
        <attribute name="abbr">
          <ref name="Text.datatype"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="axis"/>
      </optional>
      <optional>
        <attribute name="colspan" a:defaultValue="1">
          <ref name="Number.datatype"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="headers">
          <ref name="IDREFS.datatype"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="rowspan" a:defaultValue="1">
          <ref name="Number.datatype"/>
        </attribute>
      </optional>
      <ref name="scope.attrib"/>
    </define>
    <define name="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="Structural.class" combine="choice">
    <ref name="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>
  </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>
    <include href="xml-events-2.rng">
    	<define name="xmlEvents.Common.attrib">
    		<ref name="CommonNoEvents.attrib"/>
    	</define>
    </include>
    <define name="head.misc" combine="choice">
    	<ref name="xmlEvents.listener"/>
    </define>
    <define name="Structural.class" combine="choice">
    	<ref name="xmlEvents.listener"/>
    </define>
    <x:h2>XML Handlers</x:h2>
    <include href="xml-handlers-2.rng">      
      <define name="xmlHandlers.Common.attrib"> 
    	<ref name="CommonNoEvents.attrib"/> 
      </define>          
    </include>
    <define name="head.misc" combine="choice">
    	<ref name="xmlHandlers.action"/>
    </define>
    <define name="Structural.class" combine="choice">
    	<ref name="xmlHandlers.action"/>
    </define>
    <x:h2>XML Scripting</x:h2>
    <include href="xml-script-2.rng">
      <define name="xmlScripting.script.attlist">    
        <ref name="xmlScripting.implements.attrib"/>
        <ref name="xmlScripting.charset.attrib"/>
        <ref name="Common.attrib"/>
      </define> 
      <!-- redefine to use xhtml2-datatypes, which the
      vanilla XML Events 2 modules know nothing about -->
      <define name="xmlScripting.encoding.attrib">
        <optional>
          <attribute name="encoding">      	
            <ref name="Encodings.datatype"/>  	
          </attribute>
        </optional>
      </define>
      <define name="xmlScripting.implements.attrib">
        <optional>
          <attribute name="implements">        
            <ref name="URIorSafeCURIEs.datatype"/>          
          </attribute>
        </optional>  	
      </define>
      <define name="xmlScripting.type.attrib">
        <attribute name="type">
          <ref name="ContentType.datatype"/>
        </attribute>      	
      </define>
      <define name="xmlScripting.charset.attrib">
        <optional>
          <attribute name="charset">      	
      	    <ref name="Charset.datatype"/>
          </attribute>
        </optional>
      </define>      
    </include>
    <define name="xmlHandlers.action.content" combine="choice">
    	<ref name="xmlScripting.script"/>
    </define>
    <define name="head.misc" combine="choice">
    	<ref name="xmlScripting.script"/>
    </define>
    <define name="Structural.class" combine="choice">
    	<ref name="xmlScripting.script"/>
    </define>
    <define name="Text.class" combine="choice">
    	<ref name="xmlScripting.script"/>
    </define>
  <x:h2>Events Global Attributes Collection</x:h2>
  <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>
  <define name="Common.attrib" combine="interleave">
    <ref name="Events.attrib"/>
  </define>
</grammar>

C.2.3. Param

<?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>Param Module</x:h1>
  <div>
    <x:h2>The param element</x:h2>
    <define name="param">
      <element name="param">
        <ref name="param.attlist"/>
      </element>
    </define>
    <define name="param.attlist">
      <optional>
        <ref name="id.attrib"/>
      </optional>
      <attribute name="name"/>
      <optional>
        <attribute name="value"/>
      </optional>
      <optional>
        <attribute name="valuetype" a:defaultValue="data">
          <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="caption">
      <element name="caption">
        <ref name="caption.attlist"/>
        <ref name="caption.content"/>        
      </element>
    </define>
    <define name="caption.attlist">
      <ref name="Common.attrib"/>
    </define>
    <define name="caption.content">
      <ref name="Text.model"/>
    </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="role.attrib">
    <optional>
      <attribute name="role">
        <ref name="CURIEs.datatype"/>
      </attribute>
    </optional>
  </define>
  <define name="Common.attrib" combine="interleave">
    <ref name="role.attrib"/>
  </define>
  <define name="CommonNoEvents.attrib" combine="interleave">
    <ref name="role.attrib"/>
  </define>
</grammar>

C.3. RELAX NG External Modules

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

C.3.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>
          <attribute name="rbspan" a:defaultValue="1">
            <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 "Common.attrib" MUST be
      defined to integrate this module.</x:p>
    <define name="Ruby.common.attrib">
      <ref name="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.3.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.3.3. XML Events

<?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>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.2 2009/01/22 00:31:29 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"> 
    <optional>
      <attribute name="xml:id">
        <data type="ID"/>
      </attribute>
    </optional>
  </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">        
    <attribute name="phase" a:defaultValue="default">
      <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">    
    <attribute name="propagate" a:defaultValue="continue">
      <choice>
        <value>stop</value>
        <value>continue</value>
      </choice>
    </attribute>    
  </define>  
  <define name="xmlEvents.defaultAction.attrib">
    <attribute name="defaultAction" a:defaultValue="perform">
      <choice>
        <value>cancel</value>
        <value>perform</value>
      </choice>
    </attribute>
  </define>
</grammar>

C.3.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.2 2009/01/22 00:31:29 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">
    <optional>
      <attribute name="xml:id">
        <data type="ID"/>
      </attribute>
    </optional>  
  </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.3.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: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.2 2009/01/22 00:31:29 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.content"/>    	
    </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.content">
  	<text/>
  </define>
  <define name="xmlScripting.encoding.attrib">
    <optional>
      <attribute name="encoding">      	
        <list>
          <oneOrMore>
          	<data type="string"/>
          </oneOrMore>
        </list>  	
      </attribute>
    </optional>
  </define>
  <define name="xmlScripting.charset.attrib">
    <optional>
      <attribute name="charset">      	
      	<data type="string"/>
      </attribute>
    </optional>
  </define>
  <define name="xmlScripting.defer.attrib">
    <optional>
      <attribute name="defer">
      	<value>defer</value>
      </attribute>
    </optional>  	
  </define>
  <define name="xmlScripting.Common.attrib">
    <optional>
      <attribute name="xml:id">
        <data type="ID"/>
      </attribute>
    </optional>  	
  </define>
  <define name="xmlScripting.implements.attrib">
    <optional>
      <attribute name="implements">        
        <list> <!-- URIorSafeCURIEs -->
          <oneOrMore>
            <choice>
              <data type="anyURI"/>
              <data type="string">
                <param name="pattern">(([\i-[:]][\c-[:]]*)?:)?.+</param>
                <param name="minLength">1</param>
              </data>
            </choice>
          </oneOrMore>
        </list>
      </attribute>
    </optional>  	
  </define>
  <define name="xmlScripting.src.attrib">
    <optional>
      <attribute name="src">
        <data type="anyURI"/>      
      </attribute>
    </optional>  	
  </define>
  <define name="xmlScripting.type.attrib">    
    <attribute name="type">
      <data type="string"/>
    </attribute>      	
  </define>
</grammar>         

C.3.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>