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>

    <define name="class.attrib">
      <optional>
        <attribute name="class">
          <ref name="NMTOKENS.datatype"/>
        </attribute>
      </optional>
    </define>

    <define name="id.attrib">
      <optional>
        <attribute name="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>

  <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>

  <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>

  <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>

  <div>
    <x:h2>Hypertext Attribute Collection</x:h2>

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

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

    <define name="accesskey.attrib">
      <optional>
        <attribute name="accesskey">
          <ref name="Character.datatype"/>
        </attribute>
      </optional>
    </define>

    <define name="navindex.attrib">
      <optional>
        <attribute name="navindex">
          <ref name="navindexNumber.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="cite.attrib"/>
      <ref name="target.attrib"/>
      <ref name="rel.attrib"/>
      <ref name="rev.attrib"/>
      <ref name="accesskey.attrib"/>
      <ref name="navindex.attrib"/>
      <ref name="base.attrib"/>
    </define>
  </div>

  <div>
    <x:h2>Embedding Attribute 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="ContentType.datatype"/>
        </attribute>
      </optional>
    </define>

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

  <div>
    <x:h2>Image Map Attribute 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>rect</value>
            <value>circle</value>
            <value>poly</value>
            <value>default</value>
          </choice>
        </attribute>
      </optional>
    </define>

    <define name="coords.attrib">
      <optional>
        <attribute name="coords"/>
      </optional>
    </define>

    <define name="ImageMap.attrib">
      <ref name="usemap.attrib"/>
      <ref name="ismap.attrib"/>
      <ref name="shape.attrib"/>
      <ref name="coords.attrib"/>
    </define>
  </div>

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

  <define name="Common.attrib">
    <ref name="Core.attrib"/>
    <ref name="I18n.attrib"/>
    <ref name="Bidi.attrib"/>
    <ref name="Edit.attrib"/>
    <ref name="Hypertext.attrib"/>
    <ref name="Embedding.attrib"/>
    <ref name="ImageMap.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="I18n.attrib"/>
    <ref name="Bidi.attrib"/>
    <ref name="Edit.attrib"/>
    <ref name="Hypertext.attrib"/>
    <ref name="Embedding.attrib"/>
    <ref name="ImageMap.attrib"/>
    <ref name="Common.extra.attrib"/>
  </define>

</grammar>

C.1.2. Structure

<?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>Structure 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="profile.attlist"/>
    </define>

    <define name="profile.attlist">
      <optional>
        <attribute name="profile">
          <ref name="URIs.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"/>
    </define>
  </div>

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

    <define name="title">
      <element name="title">
        <ref name="title.attlist"/>
        <ref name="Inline.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="Block.model"/>
      </element>
    </define>

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

</grammar>

C.1.3. Block 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>Block Text Module</x:h1>

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

    <define name="address">
      <element name="address">
        <ref name="address.attlist"/>
        <ref name="Inline.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.attrib"/>
        <ref name="Heading.content"/>
      </element>
    </define>
 
    <define name="h1">
      <element name="h1">
        <ref name="Heading.attrib"/>
        <ref name="Heading.content"/>
      </element>
    </define>
 
    <define name="h2">
      <element name="h2">
        <ref name="Heading.attrib"/>
        <ref name="Heading.content"/>
      </element>
    </define>
     
    <define name="h3">
      <element name="h3">
        <ref name="Heading.attrib"/>
        <ref name="Heading.content"/>
      </element>
    </define>
 
    <define name="h4">
      <element name="h4">
        <ref name="Heading.attrib"/>
        <ref name="Heading.content"/>
      </element>
    </define>
 
    <define name="h5">
      <element name="h5">
        <ref name="Heading.attrib"/>
        <ref name="Heading.content"/>
      </element>
    </define>

    <define name="h6">
      <element name="h6">
        <ref name="Heading.attrib"/>
        <ref name="Heading.content"/>
      </element>
    </define>

    <define name="Heading.attrib">
      <ref name="Common.attrib"/>
    </define>
 
    <define name="Heading.content">
      <ref name="Inline.model"/>
    </define>
  </div>

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

    <define name="hr">
      <element name="hr">
        <ref name="hr.attlist"/>
      </element>
    </define>

    <define name="hr.attlist">
      <ref name="Common.attrib"/>
    </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="Inline.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>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="Block.class">
      <choice>
        <ref name="address"/>
        <ref name="blockcode"/>
        <ref name="blockquote"/>
        <ref name="div"/>
        <ref name="hr"/>
        <ref name="p"/>
        <ref name="pre"/>
        <ref name="section"/>
      </choice>
    </define>

    <define name="blockcode.model">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="Inline.class"/>
          <ref name="Heading.class"/>
          <ref name="Block.class"/>
          <ref name="List.class"/>
          <ref name="Misc.class"/>
        </choice>
      </zeroOrMore>
    </define>

    <define name="blockquote.model">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="Inline.class"/>
          <ref name="Heading.class"/>
          <ref name="Block.class"/>
          <ref name="List.class"/>
          <ref name="Misc.class"/>
        </choice>
      </zeroOrMore>
    </define>

    <define name="p.model">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="Inline.class"/>
          <ref name="List.class"/>
          <ref name="blockquote"/>
          <ref name="pre"/>
          <ref name="table"/>
          <ref name="Misc.class"/>
        </choice>
      </zeroOrMore>
    </define>

    <define name="Block.mix">
      <zeroOrMore>
        <choice>
          <ref name="Heading.class"/>
          <ref name="Block.class"/>
          <ref name="List.class"/>
          <ref name="Misc.class"/>
        </choice>
      </zeroOrMore>
    </define>

    <define name="Block.model">
      <oneOrMore>
        <ref name="Block.mix"/>
      </oneOrMore>
    </define>

    <define name="Flow.model">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="Heading.class"/>
          <ref name="Block.class"/>
          <ref name="List.class"/>
          <ref name="Inline.class"/>
          <ref name="Misc.class"/>
        </choice>
      </zeroOrMore>
    </define>
  </div>

</grammar>

C.1.4. Inline 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>Inline Text Module</x:h1>

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

    <define name="abbr">
      <element name="abbr">
        <ref name="abbr.attlist"/>
        <ref name="Inline.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="Inline.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="Inline.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="Inline.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="Inline.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="Inline.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="Inline.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="Inline.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="Inline.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="Inline.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="Inline.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="Inline.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="Inline.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="Inline.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="Inline.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="Inline.model">
      <zeroOrMore>
        <choice>
          <text/>
          <ref name="Inline.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="Inline.model"/>
      </element>
    </define>

    <define name="a.attlist">
      <ref name="Common.attrib"/>
      <optional>
        <attribute name="charset">
          <ref name="Charset.datatype"/>
        </attribute>
      </optional>
    </define>
  </div>

  <define name="Inline.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"/>
        <oneOrMore>
          <choice>
        <ref name="dt"/>
        <ref name="dd"/>
          </choice>
        </oneOrMore>
      </element>
    </define>

    <define name="dl.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="Inline.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="Inline.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"/>
        <oneOrMore>
          <ref name="li"/>
        </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"/>
        <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>
  </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. Link

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

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

    <define name="link">
      <element name="link">
        <ref name="link.attlist"/>
      </element>
    </define>

    <define name="link.attlist">
      <ref name="Common.attrib"/>
      <optional>
        <attribute name="charset">
          <ref name="Charset.datatype"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="media">
          <ref name="MediaDesc.datatype"/>
        </attribute>
      </optional>
    </define>
  </div>

  <define name="head.content" combine="interleave">
    <zeroOrMore>
      <ref name="link"/>
    </zeroOrMore>
  </define>

</grammar>

C.1.8. 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 meta element</x:h2>

    <define name="meta">
      <element name="meta">
        <ref name="meta.attlist"/>
        <choice>
          <ref name="Inline.model"/>
          <oneOrMore>
            <ref name="meta"/>
          </oneOrMore>
        </choice>
      </element>
    </define>

    <define name="meta.attlist">
      <ref name="Common.attrib"/>
      <optional>
        <attribute name="name">
          <ref name="NMTOKEN.datatype"/>
        </attribute>
      </optional>
    </define>
  </div>

  <define name="head.content" combine="interleave">
    <zeroOrMore>
      <ref name="meta"/>
    </zeroOrMore>
  </define>

</grammar>

C.1.9. 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="data">
          <ref name="URI.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="Inline.model"/>
      </element>
    </define>

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

  <define name="Inline.class" combine="choice">
    <ref name="object"/>
  </define>

</grammar>

C.1.10. Scripting

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

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

    <define name="noscript">
      <element name="noscript">
        <ref name="noscript.attlist"/>
        <ref name="Block.model"/>
      </element>
    </define>

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

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

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

    <define name="script.attlist">
      <optional>
        <attribute name="charset">
          <ref name="Charset.datatype"/>
        </attribute>
      </optional>
      <optional>
        <attribute name="declare">
          <value>declare</value>
        </attribute>
      </optional>
      <optional>
        <attribute name="src">
          <ref name="URI.datatype"/>
        </attribute>
      </optional>
      <attribute name="type">
        <ref name="ContentType.datatype"/>
      </attribute>
      <optional>
        <attribute name="xml:space">
          <value>preserve</value>
        </attribute>
      </optional>
    </define>
  </div>

  <define name="head.content" combine="interleave">
    <zeroOrMore>
      <ref name="script"/>
    </zeroOrMore>
  </define>

  <define name="Script.class">
    <choice>
      <ref name="noscript"/>
      <ref name="script"/>
    </choice>
  </define>

  <define name="Inline.class" combine="choice">
    <ref name="Script.class"/>
  </define>

  <define name="Block.class" combine="choice">
    <ref name="Script.class"/>
  </define>

</grammar>

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

  <define name="head.content" combine="interleave">
    <zeroOrMore>
      <ref name="style"/>
    </zeroOrMore>
  </define>

</grammar>

C.1.13. 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="Block.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>
      <text/>
    </define>

    <define name="Charsets.datatype">
      <x:p>A space separated list of character encodings,
        as per [RFC2045].</x:p>
      <list>
        <oneOrMore>
          <ref name="Charset.datatype"/>
        </oneOrMore>
      </list>
    </define>

    <define name="ContentType.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="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="LinkTypes.datatype">
      <x:p>Space-separated list of link types.</x:p>
      <ref name="NMTOKENS.datatype"/>
    </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="navindexNumber.datatype">
      <x:p>navindex: the position of the current element in the navingation
        order for the current document. This value must be a number between
        0 and 32767. User agents must ignore leading zeros.</x:p>
      <data type="nonNegativeInteger">
        <param name="pattern">[0-9]+</param>
        <param name="minInclusive">0</param>
        <param name="maxInclusive">32767</param>
      </data>
    </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>

    <define name="URIList.datatype">
      <x:p>A comma-separated list of URIs as defined above.</x:p>
      <text/>
    </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.content" combine="interleave">
    <zeroOrMore>
      <ref name="listener" ns="http://www.w3.org/2001/xml-events"/>
    </zeroOrMore>
  </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>
    </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="Inline.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.7 2003/05/01 04:58:15 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>