# B. XHTML 2.0 RELAX NG Definition

Contents

This appendix is normative.

This appendix contains the implementation of the XHTML 2.0 RELAX NG driver file.

### B.0.1. RELAX NG XHTML 2.0 Driver

    <?xml version="1.0" encoding="UTF-8"?>
    <grammar ns="http://www.w3.org/1999/xhtml"
             xmlns="http://relaxng.org/ns/structure/1.0"
             xmlns:x="http://www.w3.org/1999/xhtml">
      <x:h1>RELAX NG schema for XHTML 2.0</x:h1>
      <x:pre>
        Copyright ©2003-2009 W3C® (MIT, ERCIM, Keio), All Rights Reserved.
          Editors:   Masayasu Ishikawa &lt;mimasa@w3.org&gt;
                     Markus Gylling &lt;markus.gylling@tpb.se&gt;
          Revision: $Id: xhtml2.rng,v 1.42 2009/01/20 13:36:09 mgylling Exp $
        Permission to use, copy, modify and distribute this RELAX NG schema
        for XHTML 2.0 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>XHTML 2.0 modules</x:h2>
        <x:h3>Attribute Collections Module</x:h3>
        <include href="xhtml-attribs-2.rng"/>
        <x:h3>Document Module</x:h3>
        <include href="xhtml-document-2.rng"/>
        <x:h3>Structural Module</x:h3>
        <include href="xhtml-structural-2.rng"/>
        <x:h3>Text Module</x:h3>
        <include href="xhtml-text-2.rng"/>
        <x:h3>Hypertext Module</x:h3>
        <include href="xhtml-hypertext-2.rng"/>
        <x:h3>List Module</x:h3>
        <include href="xhtml-list-2.rng"/>
        <x:h3>Image Module</x:h3>
        <include href="xhtml-image-2.rng"/>
        <x:h3>Metainformation Module</x:h3>
        <include href="xhtml-meta-2.rng"/>
        <x:h3>Object Module</x:h3>
        <include href="xhtml-object-2.rng"/>
        <x:h3>Access Module</x:h3>
        <include href="xhtml-access-2.rng"/>
        <x:h3>Style Sheet Module</x:h3>
        <include href="xhtml-style-2.rng"/>
        <x:h3>Tables Module</x:h3>
        <include href="xhtml-table-2.rng"/>
        <x:h3>Support Modules</x:h3>
        <x:h4>Datatypes Module</x:h4>
        <include href="xhtml-datatypes-2.rng"/>
        <x:h4>Param Module</x:h4>
        <include href="xhtml-param-2.rng"/>
        <x:h4>Caption Module</x:h4>
        <include href="xhtml-caption-2.rng"/>
      </div>
      <div>
        <x:h2>XHTML 2.0 Legacy modules</x:h2>
        <x:h3>Legacy Edit Module</x:h3>
        <include href="xhtml-legacy-edit-2.rng"/>
        <x:h3>Legacy Line Break Module</x:h3>
        <include href="xhtml-legacy-br-2.rng"/>
        <x:h3>Legacy Headings Module</x:h3>
        <include href="xhtml-legacy-heading-2.rng"/>
      </div>
      <div>
        <x:h2>XML Events module</x:h2>
    	<include href="xhtml-events-2.rng"/>
      </div>
      <div>
        <x:h2>Ruby module</x:h2>
        <include href="full-ruby-1.rng">
          <define name="Inline.class">
            <notAllowed/>
          </define>
          <define name="NoRuby.content">
            <ref name="xhtml.Text.model"/>
          </define>
        </include>
        <define name="Inline.model">
          <notAllowed/>
        </define>
        <define name="xhtml.Text.class" combine="choice">
          <ref name="ruby"/>
        </define>
      </div>
      <div>
        <x:h2>XForms module</x:h2>
        <include href="xforms-nons-11.rng">
          <!-- override the xforms schemas any definition
          to circumvent attribute datatype collision error -->
    	  <define name="xforms.instance.content">
    	    <ref name="any"/>  <!-- TODO current excludes xhtml ns -->
    	  </define>
    	  <define name="xforms.schema.attrib">
    	    <ref name="any"/>  <!-- TODO xsd ns only? -->
    	  </define>
    	  <define name="xforms.schema.content">
    	    <ref name="any"/> <!-- TODO xsd ns only? -->
    	  </define>
        </include>
        <define name="xforms.Common.attrib" combine="interleave">
          <!-- this contributes linking and events attributes as well,
          so no need to redefine xforms.Events.attrib and xforms.Linking.attrib -->
          <!-- we have attribute name collisions with resource, encoding and target
          An option is to contribute only core and i18n into xforms.Common.attrib -->
          <ref name="xhtml.Common.attrib"/>
        </define>
        <define name="xhtml.head.misc" combine="choice">
          <ref name="xforms.model"/>
        </define>
        <define name="xhtml.Misc.class" combine="choice">
          <ref name="xforms.Core.Form.Controls"/>
          <ref name="xforms.Actions"/>
          <ref name="xforms.group"/>
          <ref name="xforms.switch"/>
          <ref name="xforms.repeat"/>
        </define>
        <define name="xforms.UI.Inline.class" combine="choice">
          <ref name="xhtml.Text.class"/>
          <ref name="xhtml.Misc.class"/>
        </define>
        <define name="any">
          <element>
            <anyName>
              <except>
                <nsName ns="http://www.w3.org/1999/xhtml"/>
              </except>
            </anyName>
            <zeroOrMore>
              <attribute>
                <anyName/>
              </attribute>
            </zeroOrMore>
            <zeroOrMore>
              <choice>
                <ref name="any"/>
                <text/>
              </choice>
            </zeroOrMore>
          </element>
        </define>
      </div>
      <div>
        <x:h2>XML Schema instance module</x:h2>
        <include href="XMLSchema-instance.rng"/>
        <define name="xhtml.html.attlist" combine="interleave">
          <optional>
            <ref name="XSI.schemaLocation"/>
          </optional>
        </define>
      </div>
    </grammar>