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 Attribute Collection</x:h2>
    <include href="xhtml-core-attrib-2.rng"/>
  </div>

  <div>
    <x:h2>I18N Attribute Collection</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 Collection</x:h2>
    <include href="xhtml-edit-attrib-2.rng"/>
  </div>

  <div>
    <x:h2>Embedding Attributes Collection</x:h2>
    <include href="xhtml-embed-attrib-2.rng"/>
  </div>

  <div>
    <x:h2>Hypertext Attributes Collection</x:h2>
    <include href="xhtml-hypertext-attrib-2.rng"/>
  </div>

  <div>
    <x:h2>Metadata Attribute Collection</x:h2>
    <include href="xhtml-meta-attrib-2.rng"/>
  </div>

  <div>
    <x:h2>Image Map Attributes Collection</x:h2>
    <include href="xhtml-imagemap-attrib-2.rng"/>
  </div>

  <define name="Common.extra.attrib">
    <empty/>
  </define>

  <define name="Common.attrib">
    <ref name="Common.extra.attrib"/>
  </define>

  <define name="CommonIdRequired.attrib">
    <attribute name="id">
      <ref name="ID.datatype"/>
    </attribute>
    <ref name="class.attrib"/>
    <ref name="title.attrib"/>
    <ref name="Common.extra.attrib"/>
  </define>

  <define name="CommonTypeRequired.attrib">
    <ref name="src.attrib"/>
    <attribute name="type">
      <ref name="ContentTypes.datatype"/>
    </attribute>
    <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"/>
      <ref name="XSI.schemaLocation"/>
    </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="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"/>
    </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 block or inline 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="label"/>
        </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 label element</x:h2>

    <define name="label">
      <element name="label">
        <ref name="label.attlist"/>
        <ref name="Text.model"/>
      </element>
    </define>

    <define name="label.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="label"/>
        <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="label"/>
        </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="label"/>
        </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="ul"/>
        <ref name="nl"/>
        <ref name="ol"/>
        <ref name="dl"/>
      </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="class.attrib">
      <optional>
        <attribute name="class">
          <ref name="NMTOKENS.datatype"/>
        </attribute>
      </optional>
    </define>

    <define name="id.attrib">
      <optional>
        <attribute name="xml:id">
          <ref name="ID.datatype"/>
        </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="title.attrib"/>
    </define>
  </div>

  <define name="Common.attrib" combine="interleave">
    <ref name="Core.attrib"/>
  </define>

  <define name="CommonTypeRequired.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="href.attrib">
      <optional>
        <attribute name="href">
          <ref name="URI.datatype"/>
        </attribute>
      </optional>
    </define>

    <define name="hreftype.attrib">
      <optional>
        <attribute name="hreftype">
          <ref name="ContentTypes.datatype"/>
        </attribute>
      </optional>
    </define>

    <define name="hreflang.attrib">
      <optional>
        <attribute name="hreflang">
          <ref name="LanguageCodes.datatype"/>
        </attribute>
      </optional>
    </define>

    <define name="cite.attrib">
      <optional>
        <attribute name="cite">
          <ref name="URI.datatype"/>
        </attribute>
      </optional>
    </define>

    <define name="target.attrib">
      <optional>
        <attribute name="target">
          <ref name="HrefTarget.datatype"/>
        </attribute>
      </optional>
    </define>

    <define name="access.attrib">
      <optional>
        <attribute name="access">
          <ref name="QName.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="base.attrib">
      <optional>
        <attribute name="xml:base">
          <ref name="URI.datatype"/>
        </attribute>
      </optional>
    </define>

    <define name="Hypertext.attrib">
      <ref name="href.attrib"/>
      <ref name="hreftype.attrib"/>
      <ref name="hreflang.attrib"/>
      <ref name="cite.attrib"/>
      <ref name="target.attrib"/>
      <ref name="access.attrib"/>
      <ref name="nextfocus.attrib"/>
      <ref name="prevfocus.attrib"/>
      <ref name="base.attrib"/>
    </define>
  </div>

  <define name="Common.extra.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.extra.attrib" combine="interleave">
    <ref name="I18n.attrib"/>
  </define>

</grammar>

C.1.10. 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="dir.attrib">
      <optional>
        <attribute name="dir">
          <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.extra.attrib" combine="interleave">
    <ref name="Bidi.attrib"/>
  </define>

</grammar>

C.1.11. 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.extra.attrib" combine="interleave">
    <ref name="Edit.attrib"/>
  </define>

</grammar>

C.1.12. 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="type.attrib">
      <optional>
        <attribute name="type">
          <ref name="ContentTypes.datatype"/>
        </attribute>
      </optional>
    </define>

    <define name="Embedding.attrib">
      <ref name="src.attrib"/>
      <ref name="type.attrib"/>
    </define>
  </div>

  <define name="Common.attrib" combine="interleave">
    <ref name="Embedding.attrib"/>
  </define>

  <define name="CommonIdRequired.attrib" combine="interleave">
    <ref name="Embedding.attrib"/>
  </define>

</grammar>

C.1.13. Handler

<?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>Handler Module</x:h1>

  <div>
    <x:h2>The handler element</x:h2>

    <define name="handler">
      <element name="handler">
        <ref name="handler.attlist"/>
        <choice>
          <text/>
          <ref name="handler"/>
        </choice>
      </element>
    </define>

    <define name="handler.attlist">
      <ref name="CommonTypeRequired.attrib"/>
      <optional>
        <attribute name="charset">
          <ref name="Charset.datatype"/>
        </attribute>
      </optional>
       <optional>
        <attribute name="declare">
          <value>declare</value>
        </attribute>
      </optional>
    </define>
  </div>

  <define name="head.misc" combine="choice">
    <ref name="handler"/>
  </define>

  <define name="Handler.class">
    <ref name="handler"/>
  </define>

  <define name="Text.class" combine="choice">
    <ref name="Handler.class"/>
  </define>

  <define name="Structural.class" combine="choice">
    <ref name="Handler.class"/>
  </define>

</grammar>

C.1.14. 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">
          <choice>
            <value>default</value>
            <value>rect</value>
            <value>circle</value>
            <value>poly</value>
          </choice>
        </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.extra.attrib" combine="interleave">
    <ref name="Map.attrib"/>
  </define>

</grammar>

C.1.15. 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="about.attrib">
      <optional>
        <attribute name="about">
          <ref name="URI.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="QName.datatype"/>
        </attribute>
      </optional>
    </define>

    <define name="property.attrib">
      <optional>
        <attribute name="property">
          <ref name="QName.datatype"/>
        </attribute>
      </optional>
    </define>

    <define name="rel.attrib">
      <optional>
        <attribute name="rel">
          <!--ref name="QName.datatype"/-->
          <ref name="LinkTypes.datatype"/>
        </attribute>
      </optional>
    </define>

    <define name="resource.attrib">
      <optional>
        <attribute name="resource">
          <ref name="URI.datatype"/>
        </attribute>
      </optional>
    </define>

    <define name="restype.attrib">
      <optional>
        <attribute name="restype">
          <ref name="ContentTypes.datatype"/>
        </attribute>
      </optional>
    </define>

    <define name="rev.attrib">
      <optional>
        <attribute name="rev">
          <!--ref name="QName.datatype"/-->
          <ref name="LinkTypes.datatype"/>
        </attribute>
      </optional>
    </define>

    <define name="Metadata.attrib">
      <ref name="about.attrib"/>
      <ref name="content.attrib"/>
      <ref name="datatype.attrib"/>
      <ref name="property.attrib"/>
      <ref name="rel.attrib"/>
      <ref name="resource.attrib"/>
      <ref name="restype.attrib"/>
      <ref name="rev.attrib"/>
    </define>
  </div>

  <define name="Common.extra.attrib" combine="interleave">
    <ref name="Metadata.attrib"/>
  </define>

</grammar>

C.1.16. 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="Structural.class" combine="choice">
    <ref name="link"/>
  </define>

  <define name="Text.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"/>
        <choice>
          <ref name="Text.model"/>
          <oneOrMore>
            <ref name="meta"/>
          </oneOrMore>
        </choice>
      </element>
    </define>

    <define name="meta.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>

  <define name="head.misc" combine="choice">
    <ref name="meta"/>
  </define>

  <define name="Structural.class" combine="choice">
    <ref name="meta"/>
  </define>

  <define name="Text.class" combine="choice">
    <ref name="meta"/>
  </define>

</grammar>

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

  <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.18. 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.extra.attrib" combine="interleave">
    <ref name="style.attrib"/>
  </define>

</grammar>

C.1.19. 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>
      <optional>
        <attribute name="media">
          <ref name="MediaDesc.datatype"/>
        </attribute>
      </optional>
    </define>
  </div>

  <define name="head.misc" combine="choice">
    <ref name="style"/>
  </define>

</grammar>

C.1.20. 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>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="Charset.datatype">
      <x:p>A character encoding, as per [RFC2045].</x:p>
      <data type="string">
        <param name="pattern">\S+</param>
      </data>
    </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="LinkTypes.datatype">
      <x:p>The value is a QName.</x:p>
      <choice>
        <value>alternate</value>
        <value>start</value>
        <value>next</value>
        <value>prev</value>
        <value>up</value>
        <value>contents</value>
        <value>index</value>
        <value>glossary</value>
        <value>copyright</value>
        <value>chapter</value>
        <value>section</value>
        <value>subsection</value>
        <value>appendix</value>
        <value>help</value>
        <value>bookmark</value>
        <value>meta</value>
        <value>icon</value>
        <value>p3pv1</value>
        <value>profile</value>
        <ref name="QName.datatype"/>
      </choice>
    </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="Shape.datatype">
      <x:p>The shape of a region.</x:p>
      <choice>
        <value>rect</value>
        <value>circle</value>
        <value>poly</value>
        <value>default</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>
          <data type="anyURI"/>
        </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>

  <define name="Events.attrib">
    <optional>
      <attribute name="ev:event">
        <ref name="NMTOKEN.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="ev:observer">
        <ref name="IDREF.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="ev:target">
        <ref name="IDREF.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="ev:handler">
        <ref name="URI.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="ev:phase" a:defaultValue="default">
        <choice>
          <value>capture</value>
          <value>default</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="ev:propagate" a:defaultValue="continue">
        <choice>
          <value>stop</value>
          <value>continue</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="ev:defaultAction" a:defaultValue="perform">
        <choice>
          <value>cancel</value>
          <value>perform</value>
        </choice>
      </attribute>
    </optional>
  </define>

  <define name="Common.extra.attrib" combine="interleave">
    <ref name="Events.attrib"/>
  </define>

  <define name="head.misc" combine="choice">
    <ref name="listener" ns="http://www.w3.org/2001/xml-events"/>
  </define>

  <define name="Script.class" combine="choice">
    <ref name="listener" ns="http://www.w3.org/2001/xml-events"/>
  </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:a="http://relaxng.org/ns/compatibility/annotations/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="Text.model"/>
      </element>
    </define>

    <define name="caption.attlist">
      <ref name="Common.attrib"/>
    </define>
  </div>

</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 ns="http://www.w3.org/2001/xml-events"
         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"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

  <x:h1>XML Events Module in RELAX NG</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: xml-events-1.rng,v 1.6 2003/04/30 06:50:03 mimasa 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="listener">
    <element name="listener">
      <ref name="listener.attlist"/>
    </element>
  </define>

  <define name="listener.attlist">
    <optional>
      <attribute name="event">
        <data type="NMTOKEN"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="observer">
        <data type="IDREF"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="target">
        <data type="IDREF"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="handler">
        <data type="anyURI"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="phase" a:defaultValue="default">
        <choice>
          <value>capture</value>
          <value>default</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="propagate" a:defaultValue="continue">
        <choice>
          <value>stop</value>
          <value>continue</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="defaultAction" a:defaultValue="perform">
        <choice>
          <value>cancel</value>
          <value>perform</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="id">
        <data type="ID"/>
      </attribute>
    </optional>
  </define>

</grammar>

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