W3C

XHTML Modularization for RelaxNG

Techniques for using RelaxNG to define and extend XHTML

16 December 2010

This version:
http://www.w3.org/MarkUp/2010/xhtml-m12n-relaxng-20101216
Editors:
Shane McCarron, Applied Testing and Technology, Inc.

This document is also available in these non-normative formats: PostScript version, PDF version, ZIP archive, and Gzip'd TAR archive.

The English version of this specification is the only normative version. Non-normative translations may also be available.


Abstract

XHTML Modularization [XHTMLMOD] defines a collection of XHTML Modules and a framework for developing new modules using DTDs and XML Schema. This document extends that collection and framework by providing implementations in RelaxNG [RELAXNG].

Status of This Document

This document is a relatively mature document. It applies the general XHTML Modularization techniques to RelaxNG. It is being published in the hope that other groups will continue the effort to make these techniques a more formal standard. The RelaxNG module implementations in this document are based heavily upon early work done by James Clark [RELAXNGXHTML].

This document has been produced by the W3C XHTML 2 Working Group as part of the HTML Activity. The goals of the XHTML 2 Working Group are discussed in the XHTML 2 Working Group charter.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the XHTML 2 group. that list also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

Please report errors in this specification to www-html-editor@w3.org (archive). It is inappropriate to send discussion email to this address. Public discussion may take place on www-html@w3.org (archive).

Table of Contents

1. Introduction

This section is informative.

This document contains rules for defining XHTML Modularization-conforming modules using RelaxNG. It also contains instructions for using such modules to create new markup languages (with or without the use of XHTML). The purpose of these rules is to extend the collection of schema grammars that can take advantage of the flexibility given by XHTML Modularization. This document also contains a collection of all the XHTML modules from XHTML Modularization defined using these rules. Finally, it includes implementations of all the W3C-defined XHTML Family Markup Languages using these modules.

2. Building RelaxNG Modules

This section is normative.

XHTML modules can be implemented using RelaxNG. When these RelaxNG components are assembled in a specific manner (described in Developing RelaxNG with defined and extended modules), the resulting RelaxNG is a representation of a complete document type. This representation can then be used for validation of instances of the document type.

The key to combining these schema components into a meaningful, cohesive schema is the rules used to define the individual RelaxNG components. This section defines those rules. When these rules are followed, markup language authors can be confident that their modules will interface cleanly with other XHTML-compatible modules.

Modules conforming to these rules also need to satisfy the conformance requirements defined in XHTML Family Module Conformance in order to be called XHTML Family Modules.

2.1. Named Content Models

This specification classifies named content model into categories and names them consistently using the following suffixes

.model
model group definitions use the suffix .model when they are used to represent the content model of an element type.
.class
model group definitions use the suffix .class when they are used to represent elements of the same class.
.mix
model group definitions use the suffix .mix when they are used to represent a collection of element types from different classes.
.attlist
attribute groups use the suffix .attlist when they are used to represent the attributes for a specific element.
.attrib
attribute groups use the suffix .attrib when they are used to represent a group of tokens representing one or more complete attribute specifications within an .attlist declaration.
.datatype
Locally defined datatypes act as the type for attributes. These are defined using the suffix .datatype.

For example, in HTML 4, the %block; parameter entity is defined to represent the heterogeneous collection of element types that are block-level elements. In this specification, the corollary named content model is xhtml.Block.mix.

When defining named content model in the classes defined here, modules should scope the names of the model group definitions and attribute groups by using unique prefixes (this recommendation uses the prefix xhtml.). For example, the content model for the element myelement in the module mymodule could be named mymodule.myelement.content. Other schemes are possible. Regardless of the scheme used, module authors should strive to ensure that named content model they define are named uniquely so that they do not collide with other named content model and so that the interface methods for the module are obvious to its users.

2.2. Defining the Namespace of a Module

XHTML requires that the elements and attributes declared in a module be within a defined XML namespace [XMLNAMES]. The identification of this namespace is an arbitrary URI. XHTML does not require that a module declare its target namespace using the ns attribute of the grammar element. XHTML Modularization using RelaxNG has adopted a "late binding" approach to associating with a namespace. This permits the development of so-called "chameleon" modules, where the elements and attributes of a module can be in more than one namespace.

2.2.1. Global and Local Element Declarations

While RelaxNG allows the definition of global and local element declarations, to be compatible with DTD definitions of XHTML Modularization, module implementations must not declare local elements.

2.2.2. Global and Local Attribute Declarations

While the approach defined here permits the definition of global as well as local attribute declarations, schema authors should consider the consequences of such definitions on a document instance. Global attributes must always be explicitly prefixed in a instance document by declaring a namespace prefix xmlns:prefix, while local attributes depending on the schema implementation may be explicitly prefixed.

2.3. Importing External Namespace RelaxNG Components

RelaxNG allows definitions that belong to a given (or inherited) target namespace. A RelaxNG grammar must use the include or externalRef element to include components from a RelaxNG grammar that uses a different target namespace. The include and externalRef elements require an href attribute and a optional ns attribute. Multiple modules (included in a document type) importing components from the same external namespace.

2.4. Datatype Definitions and Namespaces

While the elements and attributes of a module should NOT be in a namespace until they are used by a markup language, the datatypes that a module relies upon may need to be. This is especially important if the datatypes are to be shared with other markup languages. If your module has datatypes that you want to share with other modules, you should define a namespace for those datatypes, place the datatype definitions in a separate "module" and bind that module to the namespace. In XHTML Modularization, for example, we use the namespace http://www.w3.org/1999/xhtml/datatypes/.

2.5. Content Model Redefinitions

Quite often modules change the content model of elements defined by other modules. For example, the XHTML Events module adds event attributes to elements defined by the forms module. It is also possible that multiple modules may change the content model of a single element defined by a third module, for example both XHTML Events Module and XHTML Image Map module add attributes to elements in form module.

RelaxNG allows for changes to a declared content model using the combine attribute. By taking advantage of combine a language author can readily extend the content models, attribute collections, etc.

To support element content model redefinitions, all content models are defined with a .model identifier. This identifier can be easily combined when creating a new module, or in a driver module for a language.

3. Developing RelaxNG with defined and extended modules

This section is informative.

The primary purpose of defining XHTML modules and a general modularization methodology is to ease the development of document types that are based upon XHTML using RelaxNG. These document types may extend XHTML by integrating additional capabilities (e.g., [SMIL]), or they may define a subset of XHTML for use in a specialized device. This section describes the techniques that document type designers must use in order to take advantage of the RelaxNG implementation of this modularization architecture. It does this by applying the XHTML Modularization techniques in progressively more complex ways, culminating in the creation of a complete document type from disparate modules.

Note that in no case do these examples require the modification of the XHTML-provided module file entities themselves. The XHTML module file entities are completely parameterized, so that it is possible through separate module definitions and driver files to customize the definition and the content model of each element and each element's hierarchy.

Finally, remember that most users of XHTML are not expected to be RelaxNG authors. RelaxNG authors are generally people who are defining specialized markup that will improve the readability, simplify the rendering of a document, ease machine-processing of documents, or they are client designers that need to define the specialized markup language for their specific client. Consider these cases:

3.1. Defining additional attributes

In some cases, an extension to XHTML can be as simple as additional attributes. Schema authors should provide the attribute definitions for each attribute, for example:

<define name="myattrs.attrib">
    <optional>
        <attribute name="myattribute">
            <text/>
        </attribute>
    <optional>
</define>

would declare an attribute "myattr" and attribute group "myattrs.attrib". Authors should note that the attribute is created as a local attribute (as part of an attribute group). Alternatively, declaring an attribute by placing the attribute declaration as a direct child of grammar element would create a Global attribute (and document instances would have to use qualified attribute name such as xlink:show). For a discussion of qualified names and Namespace prefixes, see Defining the Namespace of a Module.

To add this attribute to the content model of an element, the attribute group (that makes the content model of the element) would need to be extended (by the document type's driver file) to include the new attribute. for example:

<define name="xhtml.a">
    <element name="a">
        <ref name="myattrs.attrib">
    </element>
</define>

Naturally, adding an attribute to a schema does not mean that any new behavior is defined for arbitrary clients. However, a content developer could use an extra attribute to store information that is accessed by associated scripts via the Document Object Model (for example).

3.2. Defining additional elements

Defining additional elements is similar to attributes, but a typical XHTML module would define the element as a global element (as a direct child of grammar element). Schema authors should first provide the element declaration for each element:

<!-- in the myml-elements-1.rng -->
<grammar ns="http://www.example.com/myml">
    <define name="myml.myelement">
        <element name="myelement">
            <ref name="myml.myelement.attlist"/>
            <ref name="myml.otherelement"/>
        </element>
    </define>

    <define name="myml.myelement.attlist">
        <optional>
            <attribute name="myattribute">
                <text/>
            </attribute>
        </optional>
    </define>

    <define name='myml.otherelement'>
        <element name='otherelement'>
            <text/>
        </element>
    </define>
</grammar>

The target namespace of "myelement" is not the XHTML namespace. After the elements are defined, they need to be integrated into the content model. Strategies for integrating new elements or sets of elements into the content model are addressed in the next section.

3.3. Defining the content model for a collection of modules

Since the content model of XHTML modules is fully parameterized using named content models, schema authors may modify the content model for every element in every module. The details of the RelaxNG module interface are defined in Building RelaxNG Modules. Basically there are two ways to approach this modification:

  1. Extend each element: xhtml.elementName.
  2. Extend a content model class that will then effect the content model of many elements: xhtml.Inline.class.

The strategy taken will depend upon the nature of the modules being combined and the nature of the elements being integrated. The remainder of this section describes techniques for integrating two different classes of modules.

3.3.1. Integrating a stand-alone module into XHTML

When a module (and remember, a module can be a collection of other modules) contains elements that only reference each other in their content model, it is said to be "internally complete". As such, the module can be used on its own; (for example, you could define a schema that was just that module, and use one of its elements as the root element). Integrating such a module into XHTML is a three step process:

  1. Decide what element(s) can be thought of as the root(s) of the new module.
  2. Decide where these elements need to attach in the XHTML content tree.
  3. Then, for each attachment point in the content tree, add the root element(s) to the content definition for the XHTML elements.

Consider attaching the elements defined above. In that example, the element myelement is the root. To attach this element under the img element, and only the img element, of XHTML, the following redefinition would work:

<define name="xhtml.img" combine="choice">
    <choice>
        <ref name="myml.myelement"/>
    </choice>
</define>

Such redefinition *could* be included with the modules implementation, but in general it is a better idea to leave this to a driver for the ultimate markup language so that the module can be included easily in ANY markup language. A schema defined with this content model would allow a document like the following fragment:

<img src="http://examples.com/image" alt="alt-text">
  <myml:myelement >This is content of a locally defined element</myml:myelement>
</img>

It is important to note that normally the XHTML element img has an empty content model. By adding myelement to that content model, we are really just replacing EMPTY with myelement. In the case of other elements that already have content models defined, the addition of an element would require the extension of the existing content model in addition to myelement.

3.3.2. Mixing a new module throughout the modules in XHTML

Extending the example above, to attach this module everywhere that the Flow.model content model group is permitted, would require something like the following in the schema that defines the document model of the document type:

<define name="xhtml.Flow.model" combine="choice">
    <ref name="myml.myelement"/>
</define>

Since the Flow content model class is used in the content model throughout the XHTML modules, the new module would become available throughout an extended XHTML document type.

3.4. Creating a new Document Type

So far the examples in this section have described the methods of extending XHTML and XHTML's content model. Once this is done, the next step is to collect the modules that comprise the Document Type into a schema driver and schema file that provides the content model redefinitions of included modules, incorporating the new definitions so that they override and augment the basic XHTML definitions as appropriate.

3.4.1. Creating a simple Document Type

Using the trivial example above, it is possible to define a new schema that uses and extends the XHTML modules pretty easily. First, define the new elements and their content model in a module:

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: simpleml-elements-1.rng -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <define name="SimpleML.element">
    <ref name="SimpleML.Common.attrib"/>
    <optional>
      <attribute name="myattribute">
        <text/>
      </attribute>
    </optional>
    <element name="element">
      <zeroOrMore>
         <choice>
           <text/>
           <ref name="SimpleML.otherelement"/>
         </choice>
       </zeroOrMore>
     </element>
  </define>

  <define name="SimpleML.otherelement">
    <ref name="SimpleML.Common.attrib"/>
    <empty/>
  </define>

  <define name="SimpleML.Common.attrib">
    <ref name="xhtml.id.attrib"/>
  </define>

  <define name="SimpleML.myattr">
    <optional>
      <attribute name="myattr"/>
    </optional>
  </define>

</grammar>

Now, define the schema driver for the new language:

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: simpleml-1.0-1.rng -->
<grammar ns="http://www.example.com/xmlns/simpleml1"
         xmlns="http://relaxng.org/ns/structure/1.0">
  
  <!-- bring in XHTML Basic -->
  <include href="../xhtml-basic-1.rng"/>
  <include href="simpleml-elements-1.rng"/>
  
  <!-- add the new myattr attribute to the img element -->
  <define name="xhtml.img.attlist" combine="interleave">
    <attribute ref="SimpleML.myattr"/>
  </define>
  
  <!-- add our root element into the Inline model -->
  <define name="xhtml.Inline.class" combine="interleave">
    <ref name="SimpleML.element"/>
  </define>

</grammar>

A language defined with this content model would allow a document like the following:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:simpleml="http://www.example.com/xmlns/simpleml1" >
<head>
<title>An example using defaults</title>
</head>
<body>
<p>This is content in the XHTML namespace</p>
<simpleml:element>
  This is content in the SimpleML namespace.
  <simpleml:otherelement />
</simpleml:element>
<p><img src="missing" alt="Missing image" simpleml:myattr="value"/></p>
</body>
</html>

3.4.2. Creating a Language by extending XHTML

Next, there is the situation where a complete, additional, and complex module is added to XHTML (or to a subset of XHTML). In essence, this is the same as in the example above, the only difference being that the module being added is incorporated in the schema by creating an new document model schema.

One such complex module is the schema for [MATHML]. In order to combine MathML and XHTML into a single schema, an author would just decide where MathML content should be legal in the document, and add the MathML root element to the content model at that point. First, define a new document model that instantiates the MathML schema and connects it to the content XHTML content model by redefining the XHTML content model. Providing a redefinition of the XHTML content model by implication includes the XHTML content model in the new document content model. Because of the concise nature of RelaxNG, we can do this all in a single driver file:

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-mathml-1.rng -->
<grammar ns="http://www.w3.org/1999/xhtml"
         xmlns:math="http://www.w3.org/1998/Math/MathML"
         xmlns="http://relaxng.org/ns/structure/1.0">
  
  <!-- bring in XHTML 1.1 -->
  <include href="../xhtml11-1.rng"/>
  <include href="http://www.w3.org/Math/RelaxNG/mathml3/mathml3.rng"/>
  
  <!-- add the mathml start element to the Inline class -->
  <define name="xhtml.Inline.class" combine="choice">
    <ref name="math"/>
  </define>

</grammar>

3.4.3. Creating a Language by removing and replacing XHTML modules

Another way in which schema authors may use XHTML modules is to define a schema that is a subset of an XHTML family document type (because, for example, they are building devices or software that only supports a subset of XHTML). To do this simply create a schema driver that does not include the relevant modules. redefinitions of modules that they do not wish to include. The basic steps to follow are:

  1. Take an XHTML family RelaxNG definition as the basis of the new document type (e.g. XHTML 1.1).
  2. Select the modules to remove from that definition - comment them out or delete them.
  3. Introduce some new modules

3.4.4. Creating a the new Document Type

Finally, some schema authors may wish to start from scratch, using the XHTML Modularization framework as a toolkit for building a new markup language. This language must be made up of the minimal, required modules from XHTML. It may also contain other XHTML-defined modules or any other module that the author wishes to employ. In this example, we will take the XHTML required modules, add some XHTML-defined modules, and also add in the module we defined above.

The first step is to define a module that defines the elements and attributes using the provided template.

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: some-file-name-VERSION.rng -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<!-- define any elements here - be sure to scope your names -->
<!-- elements should reference separate attribute groups rather than 
     embedding their attribute definitions -->

</grammar>

Now, build a driver file. This driver will include all of the modules that you want to collect together, and define/redefine/extend the content models to connect the elements together. The following example is patterned after the XHTML Basic content model, but is a complete, free-standing content model module:

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- ....................................................................... -->
<!-- file: myml-1.0-1.rng
-->

<!-- MYML
-->
<!-- A simple markup language

     Please use this URI to identify it:

         http://www.example.com/schema/RELAXNG/myml-1.0-1.rng
-->
<grammar ns="http://www.example.com/ns/myml"
         xmlns="http://relaxng.org/ns/structure/1.0">

<include href="xhtml-datatypes-1.rng"/>
<include href="xhtml-attribs-1.rng"/>
<include href="xhtml-struct-1.rng"/>
<include href="xhtml-text-1.rng"/>
<include href="xhtml-hypertext-1.rng"/>
<include href="xhtml-list-1.rng"/>
<include href="xhtml-basic-table-1.rng"/>
<include href="xhtml-pres-1.rng"/>
<include href="xhtml-edit-1.rng"/>
<include href="xhtml-bdo-1.rng"/>
<include href="xhtml-form-1.rng"/>
<include href="xhtml-image-1.rng"/>
<include href="xhtml-csismap-1.rng"/>
<include href="xhtml-ssismap-1.rng"/>
<include href="xhtml-events-1.rng"/>
<include href="xhtml-meta-1.rng"/>
<include href="xhtml-script-1.rng"/>
<include href="xhtml-style-1.rng"/>
<include href="xhtml-inlstyle-1.rng"/>
<include href="xhtml-link-1.rng"/>
<include href="xhtml-base-1.rng"/>
<include href="xhtml-ruby-1.rng"/>

</grammar>

<!-- end of MYML DRIVER  ................................................... -->
<!-- ....................................................................... -->

Once a new schema has been developed, it can be used to determine if any document is valid against the content model the schema defines.

A. XHTML RelaxNG Module Implementations

This appendix is normative.

This appendix contains implementations of the modules defined in XHTML Abstract Modules via RelaxNG. These module implementations can be used by XHTML Family Document Types.

A.1. Character Entities

RelaxNG uses DTDs to support character entities. The DTD implementation of XHTML Modularization [XHTMLMOD] defines the required character entities for XHTML. The RelaxNG implementation includes the set of character entities for XHTML, including the Latin 1, Symbol and Special character collections defined as part the DTD implementation of XHTML Modularization [XHTMLMOD].

Even though the named character entities are defined using DTDs and included in the RelaxNG Modularization Framework, it may be that RelaxNG processors will not expand the named character entities in an XML document instance. The html DOCTYPE declaration must still be present if one wishes to use named entities defined by this Framework module.

A.2. XHTML RelaxnNG Support Modules

The Modular RelaxNG framework relies upon the following component modules:

A.2.1. XHTML Datatypes

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-datatypes-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-datatypes-1.rng
     .................................................................... -->
<!-- Datatypes Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         ns="http://www.w3.org/1999/xhtml/datatypes/"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

<!-- Length defined for cellpadding/cellspacing -->

<!-- nn for pixels or nn% for percentage length -->
<define name="xhtml.Length.datatype">
  <choice>
    <data type="nonNegativeInteger"/>
    <data type="token">
      <param name="pattern">\d+[%]|\d*\.\d+[%]</param>
    </data>
  </choice>
</define>

<!-- space-separated list of link types -->
<define name="xhtml.LinkTypes.datatype">
  <data type="NMTOKEN"/>
</define>

<!-- single or comma-separated list of media descriptors -->
<define name="xhtml.MediaDesc.datatype">
  <data type="string"/>
</define>

<!-- pixel, percentage, or relative -->
<define name="xhtml.MultiLength.datatype">
  <choice>
    <ref name="xhtml.Length.datatype"/>
    <data type="token">
      <param name="pattern">\d*\*</param>
    </data>
  </choice>
</define>

<!-- one or more digits (NUMBER) -->
<define name="xhtml.Number.datatype">
  <data type="nonNegativeInteger"/>
</define>

<!-- integer representing length in pixels -->
<define name="xhtml.Pixels.datatype">
  <data type="nonNegativeInteger"/>
</define>

<!-- script expression -->
<define name="xhtml.Script.datatype">
  <data type="string"/>
</define>

<!-- textual content -->
<define name="xhtml.Text.datatype">
  <data type="string"/>
</define>
    <!-- color names or RGB color expression-->
    <define name="xhtml.Color.datatype">
    <choice>
      <data type="NMTOKEN"/>
      <data type="token">
        <param name="pattern">#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?</param>
      </data>
    </choice>
  </define>

<!-- Imported Datatypes ................................ -->

<!-- a single character from [ISO10646] -->
<define name="xhtml.Character.datatype">
  <data type="string">
    <param name="length">1</param>
  </data>
</define>

<!-- a character encoding, as per [RFC2045] -->
<define name="xhtml.Charset.datatype">
  <data type="string"/>
</define>

<!-- a space separated list of character encodings, as per [RFC2045] -->
<define name="xhtml.Charsets.datatype">
  <list>
    <data type="string"/>
  </list>
</define>

<!-- media type, as per [RFC2045] -->
<define name="xhtml.ContentType.datatype">
  <data type="string"/>
</define>

<!-- comma-separated list of media types, as per [RFC2045] -->
<define name="xhtml.ContentTypes.datatype">
  <list>
    <data type="string"/>
  </list>
</define>

<!-- date and time information. ISO date format -->
<define name="xhtml.Datetime.datatype">
  <data type="dateTime"/>
</define>

<!-- formal public identifier, as per [ISO8879] -->
<define name="xhtml.FPI.datatype">
  <data type="normalizedString"/>
</define>

<!-- a window name as used in the target attribute -->
<define name="xhtml.FrameTarget.datatype">
  <choice>
    <value>_blank"</value>
    <value>_self</value>
    <value>_parent</value>
    <value>_top</value>
    <data type="string">
      <param name="pattern">[a-zA-Z].*</param>
    </data>
  </choice>
</define>

<!-- a language code, as per [RFC1766] -->
<define name="xhtml.LanguageCode.datatype">
  <data type="language"/>
</define>

<!-- a Uniform Resource Identifier, see [URI] -->
<define name="xhtml.URI.datatype">
  <data type="anyURI"/>
</define>

<!-- a space-separated list of Uniform Resource Identifiers, see [URI] -->
<define name="xhtml.URIs.datatype">
  <list>
    <data type="anyURI"/>
  </list>
</define>

<!-- a relative URI reference to a fragment ID -->
<define name="xhtml.URIREF.datatype">
    <data type='string'>
      <param name='pattern'>#\c*</param>
      <param name='minLength'>1</param>
    </data>
</define>

<!-- place holders for RDFa -->

<define name="xhtml.CURIE.datatype">
  <data type="string">
    <param name='pattern'>(([\i-[:]][\c-[:]]*)?:)?.*</param>
    <param name='minLength'>0</param>
  </data>
</define>

<define name="xhtml.CURIEs.datatype">
  <list>
	  <data type="string">
		<param name='pattern'>(([\i-[:]][\c-[:]]*)?:)?.*</param>
		<param name='minLength'>0</param>
	  </data>
  </list>
</define>

<define name="xhtml.SafeCURIE.datatype">
  <data type="string">
    <param name="pattern">\[(([\i-[:]][\c-[:]]*)?:)?.*\]</param>
    <param name="minLength">2</param>
  </data>
</define>

<define name="xhtml.SafeCURIEs.datatype">
  <list>
    <oneOrMore>
      <ref name="xhtml.SafeCURIE.datatype"/>
    </oneOrMore>
  </list>
</define>

<define name="xhtml.URIorSafeCURIE.datatype">
  <choice>
    <ref name='xhtml.URI.datatype'/>
    <ref name='xhtml.SafeCURIE.datatype'/>
  </choice>
</define>

<define name="xhtml.URIorSafeCURIEs.datatype">
  <list>
    <oneOrMore>
      <ref name="xhtml.URIorSafeCURIE.datatype"/>
    </oneOrMore>
  </list>
</define>

</grammar>

A.2.2. XHTML Common Attribute Definitions

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-attribs-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-attribs-1.rng
     .................................................................... -->
<!-- Common Attributes Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

<define name="xhtml.id.attrib">
  <optional>
    <attribute name="id">
      <data type="ID"/>
    </attribute>
  </optional>
</define>

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

<define name="xhtml.title.attrib">
  <optional>
    <attribute name="title">
      <ref name="xhtml.Text.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.Core.attrib">
  <ref name="xhtml.id.attrib"/>
  <ref name="xhtml.class.attrib"/>
  <ref name="xhtml.title.attrib"/>
</define>

<define name="xhtml.lang.attrib">
  <optional>
    <attribute name="xml:lang">
      <ref name="xhtml.LanguageCode.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.I18n.attrib">
  <ref name="xhtml.lang.attrib"/>
</define>

<define name="xhtml.Common.attrib">
  <ref name="xhtml.Core.attrib"/>
  <ref name="xhtml.I18n.attrib"/>
</define>

<define name="xhtml.CommonIdRequired.attrib">
  <attribute name="id">
    <data type="ID"/>
  </attribute>
  <ref name="xhtml.class.attrib"/>
  <ref name="xhtml.title.attrib"/>
  <ref name="xhtml.I18n.attrib"/>
</define>

</grammar>

A.3. XHTML Module Implementations

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

A.3.1. XHTML Core Modules

A.3.1.1. Structure

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-struct-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-struct-1.rng
     .................................................................... -->
<!-- Structure Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<start>
  <ref name="xhtml.html"/>
</start>

<define name="xhtml.title">
  <element name="title">
    <ref name="xhtml.title.attlist"/>
    <text/>
  </element>
</define>

<define name="xhtml.title.attlist">
  <ref name="xhtml.I18n.attrib"/>
</define>

<define name="xhtml.head">
  <element name="head">
    <ref name="xhtml.head.attlist"/>
    <ref name="xhtml.head.content"/>
  </element>
</define>

<define name="xhtml.head.attlist">
  <ref name="xhtml.I18n.attrib"/>
  <ref name="xhtml.profile.attlist"/>
</define>

<define name="xhtml.head.content">
  <ref name="xhtml.title"/>
</define>

<define name="xhtml.profile.attlist">
  <optional>
    <attribute name="profile">
      <ref name="xhtml.URIs.datatype"/>
    </attribute>     
  </optional>
</define>

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

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

<define name="xhtml.html">
  <element name="html">
    <ref name="xhtml.html.attlist"/>
    <ref name="xhtml.head"/>
    <ref name="xhtml.body"/>
  </element>
</define>

<define name="xhtml.html.attlist">
  <ref name="xhtml.XHTML.version.attrib"/>
  <ref name="xhtml.I18n.attrib"/>
</define>

<define name="xhtml.XHTML.version.attrib">
  <optional>
    <attribute name="version">
      <text/>
    </attribute>
  </optional>
</define>

</grammar>

A.3.1.2. Text

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-text-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-text-1.rng
     .................................................................... -->
<!-- Text Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.br">
  <element name="br">
    <ref name="xhtml.br.attlist"/>
    <empty/>
  </element>
</define>

<define name="xhtml.br.attlist">
  <ref name="xhtml.Core.attrib"/>
</define>

<define name="xhtml.span">
  <element name="span">
    <ref name="xhtml.span.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.span.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.abbr">
  <element name="abbr">
    <ref name="xhtml.abbr.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.abbr.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.acronym">
  <element name="acronym">
    <ref name="xhtml.acronym.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.acronym.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.cite">
  <element name="cite">
    <ref name="xhtml.cite.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.cite.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.code">
  <element name="code">
    <ref name="xhtml.code.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.code.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.dfn">
  <element name="dfn">
    <ref name="xhtml.dfn.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.dfn.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.em">
  <element name="em">
    <ref name="xhtml.em.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.em.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.kbd">
  <element name="kbd">
    <ref name="xhtml.kbd.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.kbd.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.q">
  <element name="q">
    <ref name="xhtml.q.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.q.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="cite">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.samp">
  <element name="samp">
    <ref name="xhtml.samp.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.samp.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.strong">
  <element name="strong">
    <ref name="xhtml.strong.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.strong.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.var">
  <element name="var">
    <ref name="xhtml.var.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.var.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.div">
  <element name="div">
    <ref name="xhtml.div.attlist"/>
    <ref name="xhtml.Flow.model"/>
  </element>
</define>

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

<define name="xhtml.p">
  <element name="p">
    <ref name="xhtml.p.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.p.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.address">
  <element name="address">
    <ref name="xhtml.address.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.address.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

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

<define name="xhtml.blockquote.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="cite">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.pre">
  <element name="pre">
    <ref name="xhtml.pre.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.pre.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="xml:space">
      <value>preserve</value>
    </attribute>
  </optional>
</define>

<define name="xhtml.h1">
  <element name="h1">
    <ref name="xhtml.Heading.attrib"/>
    <ref name="xhtml.Heading.content"/>
  </element>
</define>
 
<define name="xhtml.h2">
  <element name="h2">
    <ref name="xhtml.Heading.attrib"/>
    <ref name="xhtml.Heading.content"/>
  </element>
</define>
 
<define name="xhtml.h3">
  <element name="h3">
    <ref name="xhtml.Heading.attrib"/>
    <ref name="xhtml.Heading.content"/>
  </element>
</define>
 
<define name="xhtml.h4">
  <element name="h4">
    <ref name="xhtml.Heading.attrib"/>
    <ref name="xhtml.Heading.content"/>
  </element>
</define>
 
<define name="xhtml.h5">
  <element name="h5">
    <ref name="xhtml.Heading.attrib"/>
    <ref name="xhtml.Heading.content"/>
  </element>
</define>

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

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

<define name="xhtml.Heading.class">
  <choice>
    <ref name="xhtml.h1"/>
    <ref name="xhtml.h2"/>
    <ref name="xhtml.h3"/>
    <ref name="xhtml.h4"/>
    <ref name="xhtml.h5"/>
    <ref name="xhtml.h6"/>
  </choice>
</define>

<define name="xhtml.Block.class">
  <choice>
    <ref name="xhtml.address"/>
    <ref name="xhtml.blockquote"/>
    <ref name="xhtml.div"/>
    <ref name="xhtml.p"/>
    <ref name="xhtml.pre"/>
    <ref name="xhtml.Heading.class"/>
  </choice>
</define>

<define name="xhtml.Inline.class">
  <choice>
    <ref name="xhtml.abbr"/>
    <ref name="xhtml.acronym"/>
    <ref name="xhtml.br"/>
    <ref name="xhtml.cite"/>
    <ref name="xhtml.code"/>
    <ref name="xhtml.dfn"/>
    <ref name="xhtml.em"/>
    <ref name="xhtml.kbd"/>
    <ref name="xhtml.q"/>
    <ref name="xhtml.samp"/>
    <ref name="xhtml.span"/>
    <ref name="xhtml.strong"/>
    <ref name="xhtml.var"/>
  </choice>
</define>

<define name="xhtml.Inline.model">
  <zeroOrMore>
    <choice>
      <text/>
      <ref name="xhtml.Inline.class"/>
    </choice>
  </zeroOrMore>
</define>

<!-- This is redefined by the legacy module to include inlines. -->
<define name="xhtml.Block.mix">
  <ref name="xhtml.Block.class"/>
</define>

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

<define name="xhtml.Flow.model">
  <zeroOrMore>
    <choice>
      <text/>
      <ref name="xhtml.Inline.class"/>
      <ref name="xhtml.Block.class"/>
    </choice>
  </zeroOrMore>
</define>

</grammar>

A.3.1.3. Hypertext

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-hypertext-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-hypertext-1.rng
     .................................................................... -->
<!-- Hypertext Module -->
<!-- Depends on text module. -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.a">
  <element name="a">
    <ref name="xhtml.a.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.a.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="href">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="charset">
      <ref name="xhtml.Charset.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="type">
      <ref name="xhtml.ContentType.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="hreflang">
      <ref name="xhtml.LanguageCode.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="rel">
      <ref name="xhtml.LinkTypes.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="rev">
      <ref name="xhtml.LinkTypes.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="accesskey">
      <ref name="xhtml.Character.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="tabindex">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
</define>

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

</grammar>

A.3.1.4. Lists

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-list-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-list-1.rng
     .................................................................... -->
<!-- List Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.dl">
  <element name="dl">
    <ref name="xhtml.dl.attlist"/>
    <oneOrMore>
      <choice>
	<ref name="xhtml.dt"/>
	<ref name="xhtml.dd"/>
      </choice>
    </oneOrMore>
  </element>
</define>

<define name="xhtml.dl.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.dt">
  <element name="dt">
    <ref name="xhtml.dt.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.dt.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.dd">
  <element name="dd">
    <ref name="xhtml.dd.attlist"/>
    <ref name="xhtml.Flow.model"/>
  </element>
</define>

<define name="xhtml.dd.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.ol">
  <element name="ol">
    <ref name="xhtml.ol.attlist"/>
    <oneOrMore>
      <ref name="xhtml.li"/>
    </oneOrMore>
  </element>
</define>

<define name="xhtml.ol.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.ul">
  <element name="ul">
    <ref name="xhtml.ul.attlist"/>
    <oneOrMore>
      <ref name="xhtml.li"/>
    </oneOrMore>
  </element>
</define>

<define name="xhtml.ul.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.li">
  <element name="li">
    <ref name="xhtml.li.attlist"/>
    <ref name="xhtml.Flow.model"/>
  </element>
</define>  

<define name="xhtml.li.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.List.class">
  <choice>
    <ref name="xhtml.ul"/>
    <ref name="xhtml.ol"/>
    <ref name="xhtml.dl"/>
  </choice>
</define>

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

</grammar>

A.3.2. Applet

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- file: xhtml-applet-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-applet-1.rng
     .................................................................... -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.applet">
  <element name="applet">
    <ref name="xhtml.applet.attlist"/>
    <!-- No restrictions on mixed content in TREX. -->
    <zeroOrMore>
      <ref name="xhtml.param"/>
    </zeroOrMore>
    <ref name="xhtml.Flow.model"/>
  </element>
</define>

<define name="xhtml.applet.attlist">
  <ref name="xhtml.Core.attrib"/>
  <attribute name="alt">
    <ref name="xhtml.Text.datatype"/>
  </attribute>
  <optional>
    <attribute name="archive"/>
  </optional>
  <optional>
    <attribute name="code"/>
  </optional>
  <optional>
    <attribute name="codebase">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="object"/>
  </optional>
  <attribute name="height">
    <ref name="xhtml.Length.datatype"/>
  </attribute>
  <attribute name="width">
    <ref name="xhtml.Length.datatype"/>
  </attribute>
</define>

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

</grammar>

A.3.3. Text Modules

A.3.3.1. Presentation

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-pres-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-pres-1.rng
     .................................................................... -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

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

<define name="xhtml.hr.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

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

<define name="xhtml.b">
  <element name="b">
    <ref name="xhtml.b.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.b.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.big">
  <element name="big">
    <ref name="xhtml.big.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.big.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.i">
  <element name="i">
    <ref name="xhtml.i.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.i.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.small">
  <element name="small">
    <ref name="xhtml.small.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.small.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.sub">
  <element name="sub">
    <ref name="xhtml.sub.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.sub.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.sup">
  <element name="sup">
    <ref name="xhtml.sup.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.sup.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.tt">
  <element name="tt">
    <ref name="xhtml.tt.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.tt.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.Inline.class" combine="choice">
  <choice>
    <ref name="xhtml.b"/>
    <ref name="xhtml.big"/>
    <ref name="xhtml.i"/>
    <ref name="xhtml.small"/>
    <ref name="xhtml.sub"/>
    <ref name="xhtml.sup"/>
    <ref name="xhtml.tt"/>
  </choice>
</define>

</grammar>

A.3.3.2. Edit

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-edit-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-edit-1.rng
     .................................................................... -->
<!-- Edit Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.del">
  <element name="del">
    <ref name="xhtml.del.attlist"/>
    <ref name="xhtml.Flow.model"/>
  </element>
</define>

<define name="xhtml.del.attlist">
  <ref name="xhtml.Edit.attrib"/>
</define>

<define name="xhtml.ins">
  <element name="ins">
    <ref name="xhtml.ins.attlist"/>
    <ref name="xhtml.Flow.model"/>
  </element>
</define>

<define name="xhtml.ins.attlist">
  <ref name="xhtml.Edit.attrib"/>
</define>

<define name="xhtml.Edit.attrib">
  <optional>
    <attribute name="cite">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="datetime">
      <ref name="xhtml.Datetime.datatype"/>
    </attribute>
  </optional>
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.Edit.class">
  <choice>
    <ref name="xhtml.del"/>
    <ref name="xhtml.ins"/>
  </choice>
</define>

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

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

</grammar>

A.3.3.3. Bi-directional Text

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-bdo-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-bdo-1.rng
     .................................................................... -->
<!-- Bi-directional Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.bdo">
  <element name="bdo">
    <ref name="xhtml.bdo.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.bdo.attlist">
  <ref name="xhtml.Core.attrib"/>
  <ref name="xhtml.lang.attrib"/>
  <ref name="xhtml.dir.attrib"/>
</define>

<define name="xhtml.dir.attrib">
  <attribute name="dir">
    <choice>
      <value>ltr</value>
      <value>rtl</value>
    </choice>
  </attribute>
</define>

<define name="xhtml.I18n.attrib" combine="interleave">
  <optional>
    <ref name="xhtml.dir.attrib"/>
  </optional>
</define>

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

</grammar>

A.3.4. Forms

A.3.4.1. Basic Forms

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-basic-form-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-basic-form-1.rng
     .................................................................... -->
<!-- Simplified Forms Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

<define name="xhtml.form">
  <element name="form">
    <ref name="xhtml.form.attlist"/>
    <!-- Don't use Block.model, because this gets redefined by the
	 legacy module. -->
    <oneOrMore>
      <ref name="xhtml.Block.class"/>
    </oneOrMore>
  </element>
</define>

<define name="xhtml.form.attlist">
  <ref name="xhtml.Common.attrib"/>
  <attribute name="action">
    <ref name="xhtml.URI.datatype"/>
  </attribute>
  <optional>
    <attribute name="method">
      <choice>
	<value>get</value>
	<value>post</value>
      </choice>
    </attribute>
  </optional>
  <optional>
    <attribute name="enctype">
      <ref name="xhtml.ContentType.datatype"/>
    </attribute>
  </optional>
</define>

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

<define name="xhtml.label.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="for">
      <data type="IDREF"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="accesskey">
      <ref name="xhtml.Character.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.input">
  <element name="input">
    <ref name="xhtml.input.attlist"/>
  </element>
</define>

<define name="xhtml.input.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="type">
      <ref name="xhtml.InputType.class"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="name"/>
  </optional>
  <optional>
    <attribute name="value"/>
  </optional>
  <optional>
    <attribute name="checked">
      <value>checked</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="size"/>
  </optional>
  <optional>
    <attribute name="maxlength">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="src">
       <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="accesskey">
      <ref name="xhtml.Character.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.InputType.class">
  <choice>
    <value>text</value>
    <value>password</value>
    <value>checkbox</value>
    <value>radio</value>
    <value>submit</value>
    <value>reset</value>
    <value>hidden</value>
  </choice>
</define>

<define name="xhtml.select">
  <element name="select">
    <ref name="xhtml.select.attlist"/>
    <oneOrMore>
      <ref name="xhtml.option"/>
    </oneOrMore>
  </element>
</define>

<define name="xhtml.select.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="name"/>
  </optional>
  <optional>
    <attribute name="size">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="multiple">
      <value>multiple</value>
    </attribute>
  </optional>
</define>
   
<define name="xhtml.option">
  <element name="option">
    <ref name="xhtml.Common.attrib"/>
    <optional>
      <attribute name="selected">
        <value>selected</value>
      </attribute>
    </optional>
    <optional>
      <attribute name="value"/>
    </optional>
    <text/>
  </element>
</define>

<define name="xhtml.textarea">
  <element name="textarea">
    <ref name="xhtml.textarea.attlist"/>
  </element>
</define>

<define name="xhtml.textarea.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="name"/>
  </optional>
  <attribute name="rows">
    <ref name="xhtml.Number.datatype"/>
  </attribute>
  <attribute name="cols">
    <ref name="xhtml.Number.datatype"/>
  </attribute>
  <optional>
    <attribute name="accesskey">
      <ref name="xhtml.Character.datatype"/>
    </attribute>
  </optional>
  <text/>
</define>

<define name="xhtml.Form.class">
  <ref name="xhtml.form"/>
</define>

<define name="xhtml.Formctrl.class">
  <choice>
    <ref name="xhtml.input"/>
    <ref name="xhtml.label"/>
    <ref name="xhtml.select"/>
    <ref name="xhtml.textarea"/>
  </choice>
</define>

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

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

</grammar>

A.3.4.2. Forms

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-form-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-form-1.rng
     .................................................................... -->
<!-- Forms Module -->
<!-- Unlike the DTD implementation, this builds on the xhtml-basic-form module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<include href="xhtml-basic-form-1.rng">

  <define name="xhtml.select">
    <element name="select">
      <ref name="xhtml.select.attlist"/>
      <oneOrMore>
	<choice>
	  <ref name="xhtml.option"/>
	  <ref name="xhtml.optgroup"/>
	</choice>
      </oneOrMore>
    </element>
  </define>

</include>

<define name="xhtml.form.attlist" combine="interleave">
  <optional>
    <attribute name="accept-charset">
      <ref name="xhtml.Charsets.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="accept">
      <ref name="xhtml.ContentTypes.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="name"/>
  </optional>
</define>

<define name="xhtml.input.attlist" combine="interleave">
  <optional>
    <attribute name="disabled">
      <value>disabled</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="readonly">
      <value>readonly</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="alt"/>
  </optional>
  <optional>
    <attribute name="tabindex">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="accept">
      <ref name="xhtml.ContentTypes.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.InputType.class" combine="choice">
  <choice>
    <value>image</value>
    <value>button</value>
    <value>file</value>
  </choice>
</define>

<define name="xhtml.select.attlist" combine="interleave">
  <optional>
    <attribute name="disabled">
      <value>disabled</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="tabindex">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.option.attlist" combine="interleave">
  <optional>
    <attribute name="disabled">
      <value>disabled</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="label">
      <ref name="xhtml.Text.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.optgroup">
  <element name="optgroup">
    <ref name="xhtml.optgroup.attlist"/>
    <oneOrMore>
      <ref name="xhtml.option"/>
    </oneOrMore>
  </element>
</define>

<define name="xhtml.optgroup.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="disabled">
      <value>disabled</value>
    </attribute>
  </optional>
  <attribute name="label">
    <ref name="xhtml.Text.datatype"/>
  </attribute>
</define>

<define name="xhtml.textarea.attlist" combine="interleave">
  <optional>
    <attribute name="disabled">
      <value>disabled</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="readonly">
      <value>readonly</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="tabindex">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.fieldset">
  <element name="fieldset">
    <ref name="xhtml.fieldset.attlist"/>
    <ref name="xhtml.legend"/>
    <ref name="xhtml.Flow.model"/>
  </element>
</define>

<define name="xhtml.fieldset.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.button">
  <element name="button">
    <ref name="xhtml.button.attlist"/>
    <ref name="xhtml.Flow.model"/>
  </element>
</define>

<define name="xhtml.button.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="name"/>
  </optional>
  <optional>
    <attribute name="value"/>
  </optional>
  <optional>
    <attribute name="type">
      <choice>
        <value>button</value>
        <value>submit</value>
        <value>reset</value>
      </choice>
    </attribute>
  </optional>
  <optional>
    <attribute name="disabled">
      <value>disabled</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="tabindex">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="accesskey">
      <ref name="xhtml.Character.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.legend">
  <element name="legend">
    <ref name="xhtml.legend.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.legend.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="accesskey">
      <ref name="xhtml.Character.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.Form.class" combine="choice">
  <ref name="xhtml.fieldset"/>
</define>

<define name="xhtml.Formctrl.class" combine="choice">
  <ref name="xhtml.button"/>
</define>

</grammar>

A.3.5. Tables

A.3.5.1. Basic Tables

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-basic-table-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-basic-table-1.rng
     .................................................................... -->
<!-- Basic Tables Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

<define name="xhtml.table">
  <element name="table">
    <ref name="xhtml.table.attlist"/>
    <optional>
      <ref name="xhtml.caption"/>
    </optional>
    <oneOrMore>
      <ref name="xhtml.tr"/>
    </oneOrMore>
  </element>
</define>

<define name="xhtml.table.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="summary">
      <ref name="xhtml.Text.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.caption">
  <element name="caption">
    <ref name="xhtml.caption.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

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

<define name="xhtml.tr">
  <element name="tr">
    <ref name="xhtml.tr.attlist"/>
    <oneOrMore>
      <choice>
        <ref name="xhtml.th"/>
        <ref name="xhtml.td"/>
      </choice>
    </oneOrMore>
  </element>
</define>

<define name="xhtml.tr.attlist">
  <ref name="xhtml.Common.attrib"/>
  <ref name="xhtml.CellHAlign.attrib"/>
  <ref name="xhtml.CellVAlign.attrib"/>
</define>

<define name="xhtml.th">
  <element name="th">
    <ref name="xhtml.th.attlist"/>
    <ref name="xhtml.Flow.model"/>
  </element>
</define>

<define name="xhtml.th.attlist">
  <ref name="xhtml.Cell.attrib"/>
</define>

<define name="xhtml.td">
  <element name="td">
    <ref name="xhtml.td.attlist"/>
    <ref name="xhtml.Flow.model"/>
  </element>
</define>

<define name="xhtml.td.attlist">
  <ref name="xhtml.Cell.attrib"/>
</define>

<define name="xhtml.Cell.attrib">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="abbr">
      <ref name="xhtml.Text.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="axis"/>
  </optional>
  <optional>
    <attribute name="headers">
      <data type="IDREFS"/>
    </attribute>
  </optional>
  <ref name="xhtml.scope.attrib"/>
  <optional>
    <attribute name="rowspan">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="colspan">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
  <ref name="xhtml.CellHAlign.attrib"/>
  <ref name="xhtml.CellVAlign.attrib"/>
</define>

<define name="xhtml.CellHAlign.attrib">
  <optional>
    <attribute name="align">
      <choice>
	<value>left</value>
	<value>center</value>
	<value>right</value>
      </choice>
    </attribute>
  </optional>
</define>

<define name="xhtml.CellVAlign.attrib">
  <optional>
    <attribute name="valign">
      <choice>
	<value>top</value>
	<value>middle</value>
	<value>bottom</value>
      </choice>
    </attribute>
  </optional>
</define>

<define name="xhtml.scope.attrib">
  <optional>
    <attribute name="scope">
      <choice>
	<value>row</value>
	<value>col</value>
      </choice>
    </attribute>
  </optional>
</define>

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

</grammar>

A.3.5.2. Tables

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-table-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-table-1.rng
     .................................................................... -->
<!-- Tables Module -->
<!-- This builds on the xhtml basic tables module, unlike with the DTD
implementation. -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<include href="xhtml-basic-table-1.rng">

  <define name="xhtml.table">
    <element name="table">
      <ref name="xhtml.table.attlist"/>
      <optional>
	<ref name="xhtml.caption"/>
      </optional>
      <choice>
	<zeroOrMore>
	  <ref name="xhtml.col"/>
	</zeroOrMore>
	<zeroOrMore>
	  <ref name="xhtml.colgroup"/>
	</zeroOrMore>
      </choice>
      <choice>
	<group>
	  <optional>
	    <ref name="xhtml.thead"/>
	  </optional>
	  <optional>
	    <ref name="xhtml.tfoot"/>
	  </optional>
	  <oneOrMore>
	    <ref name="xhtml.tbody"/>
	  </oneOrMore>
	</group>
	<oneOrMore>
	  <ref name="xhtml.tr"/>
	</oneOrMore>
      </choice>
    </element>
  </define>

  <define name="xhtml.th">
    <element name="th">
      <ref name="xhtml.th.attlist"/>
      <ref name="xhtml.Flow.model"/>
    </element>
  </define>

  <define name="xhtml.td">
    <element name="td">
      <ref name="xhtml.td.attlist"/>
      <ref name="xhtml.Flow.model"/>
    </element>
  </define>

  <define name="xhtml.CellHAlign.attrib">
    <optional>
      <attribute name="align">
	<choice>
	  <value>left</value>
	  <value>center</value>
	  <value>right</value>
	  <value>justify</value>
	  <value>char</value>
	</choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="char">
	<ref name="xhtml.Character.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="charoff">
	<ref name="xhtml.Length.datatype"/>
      </attribute>
    </optional>
  </define>

  <define name="xhtml.CellVAlign.attrib">
    <optional>
      <attribute name="valign">
	<choice>
	  <value>top</value>
	  <value>middle</value>
	  <value>bottom</value>
	  <value>baseline</value>
	</choice>
      </attribute>
    </optional>
  </define>

  <define name="xhtml.scope.attrib">
    <optional>
      <attribute name="scope">
	<choice>
	  <value>row</value>
	  <value>col</value>
	  <value>rowgroup</value>
	  <value>colgroup</value>
	</choice>
      </attribute>
    </optional>
  </define>

</include>

<define name="xhtml.table.attlist" combine="interleave">
  <optional>
    <attribute name="width">
      <ref name="xhtml.Length.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="border">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
  <ref name="xhtml.frame.attrib"/>
  <ref name="xhtml.rules.attrib"/>
  <optional>
    <attribute name="cellspacing">
      <ref name="xhtml.Length.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="cellpadding">
      <ref name="xhtml.Length.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.col">
  <element name="col">
    <ref name="xhtml.col.attlist"/>
  </element>
</define>

<define name="xhtml.col.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="span">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="width">
      <ref name="xhtml.MultiLength.datatype"/>
    </attribute>
  </optional>
  <ref name="xhtml.CellHAlign.attrib"/>
  <ref name="xhtml.CellVAlign.attrib"/>
</define>

<define name="xhtml.colgroup">
  <element name="colgroup">
    <ref name="xhtml.colgroup.attlist"/>
    <zeroOrMore>
      <ref name="xhtml.col"/>
    </zeroOrMore>
  </element>
</define>

<define name="xhtml.colgroup.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="span">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="width">
      <ref name="xhtml.MultiLength.datatype"/>
    </attribute>
  </optional>
  <ref name="xhtml.CellHAlign.attrib"/>
  <ref name="xhtml.CellVAlign.attrib"/>
</define>

<define name="xhtml.tbody">
  <element name="tbody">
    <ref name="xhtml.tbody.attlist"/>
    <oneOrMore>
      <ref name="xhtml.tr"/>
    </oneOrMore>
  </element>
</define>

<define name="xhtml.tbody.attlist">
  <ref name="xhtml.Common.attrib"/>
  <ref name="xhtml.CellHAlign.attrib"/>
  <ref name="xhtml.CellVAlign.attrib"/>
</define>

<define name="xhtml.thead">
  <element name="thead">
    <ref name="xhtml.thead.attlist"/>
    <oneOrMore>
      <ref name="xhtml.tr"/>
    </oneOrMore>
  </element>
</define>

<define name="xhtml.thead.attlist">
  <ref name="xhtml.Common.attrib"/>
  <ref name="xhtml.CellHAlign.attrib"/>
  <ref name="xhtml.CellVAlign.attrib"/>
</define>

<define name="xhtml.tfoot">
  <element name="tfoot">
    <ref name="xhtml.tfoot.attlist"/>
    <oneOrMore>
      <ref name="xhtml.tr"/>
    </oneOrMore>
  </element>
</define>

<define name="xhtml.tfoot.attlist">
  <ref name="xhtml.Common.attrib"/>
  <ref name="xhtml.CellHAlign.attrib"/>
  <ref name="xhtml.CellVAlign.attrib"/>
</define>

<define name="xhtml.frame.attrib">
  <optional>
    <attribute name="frame">
      <choice>
        <value>void</value>
        <value>above</value>
        <value>below</value>
        <value>hsides</value>
        <value>lhs</value>
        <value>rhs</value>
        <value>vsides</value>
        <value>box</value>
        <value>border</value>
      </choice>
    </attribute>
  </optional>
</define>

<define name="xhtml.rules.attrib">
  <optional>
    <attribute name="rules">
      <choice>
        <value>none</value>
        <value>groups</value>
        <value>rows</value>
        <value>cols</value>
        <value>all</value>
      </choice>
    </attribute>
  </optional>
</define>

</grammar>

A.3.6. Image

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-image-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-image-1.rng
     .................................................................... -->
<!-- Image Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.img">
  <element name="img">
    <ref name="xhtml.img.attlist"/>
  </element>
</define>

<define name="xhtml.img.attlist">
  <ref name="xhtml.Common.attrib"/>
  <attribute name="src">
    <ref name="xhtml.URI.datatype"/>
  </attribute>
  <attribute name="alt">
    <ref name="xhtml.Text.datatype"/>
  </attribute>
  <optional>
    <attribute name="longdesc">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="height">
      <ref name="xhtml.Length.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="width">
      <ref name="xhtml.Length.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="name"/>
  </optional>
</define>

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

</grammar>

A.3.7. Client-side Image Map

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-csismap-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-csismap-1.rng
     .................................................................... -->
<!-- Client-side Image Map Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.area">
  <element name="area">
    <ref name="xhtml.area.attlist"/>
  </element>
</define>

<define name="xhtml.area.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="href">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
  <ref name="xhtml.shape.attrib"/>
  <ref name="xhtml.coords.attrib"/>
  <optional>
    <attribute name="nohref">
      <value>nohref</value>
    </attribute>
  </optional>
  <attribute name="alt">
    <ref name="xhtml.Text.datatype"/>
  </attribute>
  <optional>
    <attribute name="tabindex">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="accesskey">
      <ref name="xhtml.Character.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.map">
  <element name="map">
    <ref name="xhtml.map.attlist"/>
    <oneOrMore>
      <choice>
        <!-- This does not use Block.mix
             because loose.dtd doesn't use %Flow; -->
        <ref name="xhtml.Block.class"/>
        <ref name="xhtml.area"/>
      </choice>
    </oneOrMore>
  </element>
</define>

<define name="xhtml.map.attlist">
  <ref name="xhtml.CommonIdRequired.attrib"/>
</define>

<define name="xhtml.a.attlist" combine="interleave">
  <ref name="xhtml.shape.attrib"/>
  <ref name="xhtml.coords.attrib"/>
</define>

<define name="xhtml.img.attlist" combine="interleave">
  <ref name="xhtml.usemap.attlist"/>
</define>

<define name="xhtml.object.attlist" combine="interleave">
  <ref name="xhtml.usemap.attlist"/>
</define>

<define name="xhtml.usemap.attlist">
  <optional>
    <attribute name="usemap">
      <ref name="xhtml.URIREF.datatype"/>
    </attribute>
  </optional>
</define>

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

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

</grammar>

A.3.8. Server-side Image Map

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-ssismap-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-ssismap-1.rng
     .................................................................... -->
<!-- Server-side Image Map Module -->
<!-- Depends on image module. -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.img.attlist" combine="interleave">
  <optional>
    <attribute name="ismap">
      <value>ismap</value>
    </attribute>
  </optional>
</define>

</grammar>

A.3.9. Object

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-object-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-object-1.rng
     .................................................................... -->
<!-- Object Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.object">
  <element name="object">
    <ref name="xhtml.object.attlist"/>
    <!-- No restrictions on mixed content in TREX. -->
    <zeroOrMore>
      <ref name="xhtml.param"/>
    </zeroOrMore>
    <ref name="xhtml.Flow.model"/>
  </element>
</define>

<define name="xhtml.object.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="declare">
      <value>declare</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="classid">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="codebase">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="data">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="type">
      <ref name="xhtml.ContentType.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="codetype">
      <ref name="xhtml.ContentType.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="archive">
      <ref name="xhtml.URIs.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="standby">
      <ref name="xhtml.Text.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="height">
      <ref name="xhtml.Length.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="width">
      <ref name="xhtml.Length.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="name"/>
  </optional>
  <optional>
    <attribute name="tabindex">
      <ref name="xhtml.Number.datatype"/>
    </attribute>
  </optional>
</define>

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

</grammar>

A.3.10. Frames

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-frames-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-frames-1.rng
     .................................................................... -->
<!-- Frames Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<include href="struct.rng">

  <define name="xhtml.html">
    <element name="html">
      <ref name="xhtml.html.attlist"/>
      <ref name="xhtml.head"/>
      <ref name="xhtml.frameset"/>
    </element>
  </define>

</include>

<define name="xhtml.frameset">
  <element name="frameset">
    <ref name="xhtml.frameset.attlist"/>
    <interleave>
      <oneOrMore>
	<choice>
	  <ref name="xhtml.frameset"/>
	  <ref name="xhtml.frame"/>
	</choice>
      </oneOrMore>
      <optional>
	<ref name="xhtml.noframes"/>
      </optional>
    </interleave>
  </element>
</define>

<define name="xhtml.frameset.attlist">
  <ref name="xhtml.Core.attrib"/>
  <optional>
    <attribute name="cols">
      <ref name="xhtml.MultiLength.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="rows">
      <ref name="xhtml.MultiLength.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.frame">
  <element name="frame">
    <ref name="xhtml.frame.attlist"/>
  </element>
</define>

<define name="xhtml.frame.attlist">
  <ref name="xhtml.Core.attrib"/>
  <optional>
    <attribute name="longdesc">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="src">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="frameborder">
      <choice>
        <value>1</value>
        <value>0</value>
      </choice>
    </attribute>
  </optional>
  <optional>
    <attribute name="marginwidth">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="marginheight">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="noresize">
      <value>noresize</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="scrolling">
      <choice>
        <value>yes</value>
        <value>no</value>
        <value>auto</value>
      </choice>
    </attribute>
  </optional>
</define>

<define name="xhtml.noframes">
  <element name="noframes">
    <ref name="xhtml.noframes.attlist"/>
    <ref name="xhtml.body"/>
  </element>
</define>

<define name="xhtml.noframes.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

</grammar>

A.3.11. Target

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-target-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-target-1.rng
     .................................................................... -->
<!-- Target Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.a.attlist" combine="interleave">
  <ref name="xhtml.target.attrib"/>
</define>

<define name="xhtml.area.attlist" combine="interleave">
  <ref name="xhtml.target.attrib"/>
</define>

<define name="xhtml.base.attlist" combine="interleave">
  <ref name="xhtml.target.attrib"/>
</define>

<define name="xhtml.link.attrib" combine="interleave">
  <ref name="xhtml.target.attrib"/>
</define>

<define name="xhtml.form.attlist" combine="interleave">
  <ref name="xhtml.target.attrib"/>
</define>

<define name="xhtml.target.attrib">
  <optional>
    <attribute name="target"/>
  </optional>
</define>

</grammar>

A.3.12. Iframe

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-iframe-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-iframe-1.rng
     .................................................................... -->
<!-- Iframe Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.iframe">
  <element name="iframe">
    <ref name="xhtml.iframe.attlist"/>
    <ref name="xhtml.Flow.model"/>
  </element>
</define>

<define name="xhtml.iframe.attlist">
  <ref name="xhtml.Core.attrib"/>
  <optional>
    <attribute name="longdesc">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="src">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="frameborder">
      <choice>
        <value>1</value>
        <value>0</value>
      </choice>
    </attribute>
  </optional>
  <optional>
    <attribute name="width">
      <ref name="xhtml.Length.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="height">
      <ref name="xhtml.Length.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="marginwidth">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="marginheight">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="scrolling">
      <choice>
        <value>yes</value>
        <value>no</value>
        <value>auto</value>
      </choice>
    </attribute>
  </optional>
</define>

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

</grammar>

A.3.13. Intrinsic Events

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-events-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-events-1.rng
     .................................................................... -->
<!-- Events Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.a.attlist" combine="interleave">
  <optional>
    <attribute name="onblur">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onfocus">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.area.attlist" combine="interleave">
  <optional>
    <attribute name="onblur">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onfocus">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.form.attlist" combine="interleave">
  <optional>
    <attribute name="onreset">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onsubmit">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.body.attlist" combine="interleave">
  <optional>
    <attribute name="onload">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onunload">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.label.attlist" combine="interleave">
  <optional>
    <attribute name="onblur">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onfocus">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.input.attlist" combine="interleave">
  <optional>
    <attribute name="onblur">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onchange">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onfocus">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onselect">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.select.attlist" combine="interleave">
  <optional>
    <attribute name="onblur">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onchange">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onfocus">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.textarea.attlist" combine="interleave">
  <optional>
    <attribute name="onblur">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onchange">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onfocus">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onselect">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.button.attlist" combine="interleave">
  <optional>
    <attribute name="onblur">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onfocus">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.Events.attrib">
  <optional>
    <attribute name="onclick">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="ondblclick">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onmousedown">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onmouseup">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onmouseover">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onmousemove">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onmouseout">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onkeypress">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onkeydown">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="onkeyup">
      <ref name="xhtml.Script.datatype"/>
    </attribute>
  </optional>
</define>

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

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

</grammar>

A.3.14. Metainformation

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-meta-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-meta-1.rng
     .................................................................... -->
<!-- Meta Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

<define name="xhtml.meta">
  <element name="meta">
    <ref name="xhtml.meta.attlist"/>
  </element>
</define>

<define name="xhtml.meta.attlist">
  <ref name="xhtml.I18n.attrib"/>
  <attribute name="content">
    <text/>
  </attribute>
  <optional>
    <attribute name="http-equiv">
      <data type='NMTOKEN'/>
    </attribute>
  </optional>
  <optional>
    <attribute name="name">
      <data type="NMTOKEN"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="scheme">
	  <text/>
	</attribute>
  </optional>
</define>

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

</grammar>

A.3.15. Scripting

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-script-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-script-1.rng
     .................................................................... -->
<!-- Script Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

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

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

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

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

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

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

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

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

</grammar>

A.3.16. Style Sheet

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-style-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-style-1.rng
     .................................................................... -->
<!-- Style Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.style">
  <element name="style">
    <ref name="xhtml.style.attlist"/>
    <text/>
  </element>
</define>

<define name="xhtml.style.attlist">
  <ref name="xhtml.title.attrib"/>
  <ref name="xhtml.I18n.attrib"/>
  <attribute name="type">
    <ref name="xhtml.ContentType.datatype"/>
  </attribute>
  <optional>
    <attribute name="media">
      <ref name="xhtml.MediaDesc.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="xml:space">
      <value>preserve</value>
    </attribute>
  </optional>
</define>

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

</grammar>

A.3.17. Style Attribute

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-inlstyle-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-inlstyle-1.rng
     .................................................................... -->
<!-- Inline Style Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.Core.attrib" combine="interleave">
  <optional>
    <attribute name="style"/>
  </optional>
</define>

</grammar>

A.3.18. Link

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-link-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-link-1.rng
     .................................................................... -->
<!-- Link Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

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

<define name="xhtml.link.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="charset">
      <ref name="xhtml.Charset.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="href">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="hreflang">
      <ref name="xhtml.LanguageCode.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="type">
      <ref name="xhtml.ContentType.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="rel">
      <ref name="xhtml.LinkTypes.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="rev">
      <ref name="xhtml.LinkTypes.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="media">
      <ref name="xhtml.MediaDesc.datatype"/>
    </attribute>
  </optional>
</define>

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

</grammar>

A.3.19. Base

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-base-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-base-1.rng
     .................................................................... -->
<!-- Base Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.base">
  <element name="base">
    <ref name="xhtml.base.attlist"/>
  </element>
</define>

<define name="xhtml.base.attlist">
  <attribute name="href">
    <ref name="xhtml.URI.datatype"/>
  </attribute>
</define>

<define name="xhtml.head.content" combine="interleave">
  <optional>
    <ref name="xhtml.base"/>
  </optional>
</define>

</grammar>

A.3.20. Name Identification

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-nameident-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-nameident-1.rng
     .................................................................... -->
<!-- Name Identification Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.a.attlist" combine="interleave">
  <ref name="xhtml.name.attlist"/>
</define>

<define name="xhtml.applet.attlist" combine="interleave">
  <ref name="xhtml.name.attlist"/>
</define>

<define name="xhtml.form.attlist" combine="interleave">
  <ref name="xhtml.name.attlist"/>
</define>

<define name="xhtml.frame.attrib" combine="interleave">
  <ref name="xhtml.name.attlist"/>
</define>

<define name="xhtml.iframe.attlist" combine="interleave">
  <ref name="xhtml.name.attlist"/>
</define>

<define name="xhtml.img.attlist" combine="interleave">
  <ref name="xhtml.name.attlist"/>
</define>

<define name="xhtml.map.attlist" combine="interleave">
  <ref name="xhtml.name.attlist"/>
</define>

<define name="xhtml.name.attlist">
  <optional>
    <attribute name="name"/>
  </optional>
</define>

</grammar>

A.3.21. Legacy

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-legacy-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-legacy-1.rng
     .................................................................... -->
<!-- Legacy Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.lang.attrib" combine="interleave">
  <optional>
    <attribute name="lang">
      <ref name="xhtml.LanguageCode.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.basefont">
  <element name="basefont">
    <ref name="xhtml.basefont.attlist"/>
  </element>
</define>

<define name="xhtml.basefont.attlist">
  <ref name="xhtml.id.attrib"/>
  <ref name="xhtml.size.attrib"/>
  <ref name="xhtml.Font.attrib"/>
</define>

<define name="xhtml.center">
  <element name="center">
    <ref name="xhtml.center.attlist"/>
    <ref name="xhtml.Flow.model"/>
  </element>
</define>

<define name="xhtml.center.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.font">
  <element name="font">
    <ref name="xhtml.font.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.font.attlist">
  <ref name="xhtml.Core.attrib"/>
  <ref name="xhtml.I18n.attrib"/>
  <ref name="xhtml.Font.attrib"/>
  <optional>
    <attribute name="size"/>
  </optional>
</define>

<define name="xhtml.Font.attrib">
  <optional>
    <attribute name="color">
      <ref name="xhtml.Color.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="face"/>
  </optional>
</define>

<define name="xhtml.s">
  <element name="s">
    <ref name="xhtml.s.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.s.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.strike">
  <element name="strike">
    <ref name="xhtml.strike.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.strike.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.u">
  <element name="u">
    <ref name="xhtml.u.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.u.attlist">
  <ref name="xhtml.Common.attrib"/>
</define>

<define name="xhtml.dir">
  <element name="dir">
    <ref name="xhtml.dir.attlist"/>
    <oneOrMore>
      <ref name="xhtml.li.noblock"/>
    </oneOrMore>
  </element>
</define>

<define name="xhtml.dir.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="compact">
      <value>compact</value>
    </attribute>
  </optional>
</define>

<define name="xhtml.menu">
  <element name="menu">
    <ref name="xhtml.menu.attlist"/>
    <oneOrMore>
      <ref name="xhtml.li.noblock"/>
    </oneOrMore>
  </element>
</define>

<define name="xhtml.menu.attlist">
  <ref name="xhtml.Common.attrib"/>
  <optional>
    <attribute name="compact">
      <value>compact</value>
    </attribute>
  </optional>
</define>

<define name="xhtml.li.noblock">
  <element name="li">
    <ref name="xhtml.li.attlist"/>
    <ref name="xhtml.Inline.model"/>
  </element>
</define>

<define name="xhtml.isindex">
  <element name="isindex">
    <ref name="xhtml.isindex.attlist"/>
  </element>
</define>

<define name="xhtml.isindex.attlist">
  <ref name="xhtml.Core.attrib"/>
  <ref name="xhtml.I18n.attrib"/>
  <optional>
    <attribute name="prompt">
      <ref name="xhtml.Text.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.applet.attlist" combine="interleave">
  <optional>
    <attribute name="align">
      <choice>
	<value>top</value>
	<value>middle</value>
	<value>bottom</value>
	<value>left</value>
	<value>right</value>
      </choice>
    </attribute>
  </optional>
  <optional>
    <attribute name="hspace">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="vspace">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.body.attlist" combine="interleave">
  <optional>
    <attribute name="background">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="bgcolor">
      <ref name="xhtml.Color.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="text">
      <ref name="xhtml.Color.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="link">
      <ref name="xhtml.Color.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="vlink">
      <ref name="xhtml.Color.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="alink">
      <ref name="xhtml.Color.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.br.attlist" combine="interleave">
  <optional>
    <attribute name="clear">
      <choice>
	<value>left</value>
	<value>all</value>
	<value>right</value>
	<value>none</value>
      </choice>
    </attribute>
  </optional>
</define>

<define name="xhtml.caption.attlist" combine="interleave">
  <ref name="xhtml.align.attrib"/>
</define>

<define name="xhtml.div.attlist" combine="interleave">
  <ref name="xhtml.align.attrib"/>
</define>

<!-- Not in the CR, but surely an error. -->

<define name="xhtml.dl.attlist" combine="interleave">
  <optional>
    <attribute name="compact">
      <value>compact</value>
    </attribute>
  </optional>
</define>

<define name="xhtml.Heading.attrib" combine="interleave">
  <ref name="xhtml.align.attrib"/>
</define>

<define name="xhtml.hr.attlist" combine="interleave">
  <optional>
    <attribute name="align">
      <choice>
	<value>left</value>
	<value>center</value>
	<value>right</value>
      </choice>
    </attribute>
  </optional>
  <optional>
    <attribute name="noshade">
      <value>noshade</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="size">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="width">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.img.attlist" combine="interleave">
  <optional>
    <attribute name="align">
      <choice>
	<value>top</value>
	<value>middle</value>
	<value>bottom</value>
	<value>left</value>
	<value>right</value>
      </choice>
    </attribute>
  </optional>
  <optional>
    <attribute name="border">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="hspace">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="vspace">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.input.attlist" combine="interleave">
  <ref name="xhtml.align.attrib"/>
</define>

<define name="xhtml.legend.attlist" combine="interleave">
  <optional>
    <attribute name="align">
      <choice>
	<value>top</value>
	<value>bottom</value>
	<value>left</value>
	<value>right</value>
      </choice>
    </attribute>
  </optional>
</define>

<define name="xhtml.li.attlist" combine="interleave">
  <optional>
    <attribute name="type"/>
  </optional>
  <optional>
    <attribute name="value"/>
  </optional>
</define>

<define name="xhtml.object.attlist" combine="interleave">
  <optional>
    <attribute name="align">
      <choice>
	<value>top</value>
	<value>middle</value>
	<value>bottom</value>
	<value>left</value>
	<value>right</value>
      </choice>
    </attribute>
  </optional>
  <optional>
    <attribute name="border">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="hspace">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="vspace">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.ol.attlist" combine="interleave">
  <optional>
    <attribute name="type"/>
  </optional>
  <optional>
    <attribute name="compact">
      <value>compact</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="start"/>
  </optional>
</define>

<define name="xhtml.p.attlist" combine="interleave">
  <ref name="xhtml.align.attrib"/>
</define>

<define name="xhtml.pre.attlist" combine="interleave">
  <optional>
    <attribute name="width">
      <ref name="xhtml.Length.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.script.attlist" combine="interleave">
  <optional>
    <attribute name="language">
      <ref name="xhtml.ContentType.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.table.attlist" combine="interleave">
  <ref name="xhtml.align.attrib"/>
  <optional>
    <attribute name="bgcolor">
      <ref name="xhtml.Color.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.tr.attlist" combine="interleave">
  <optional>
    <attribute name="bgcolor">
      <ref name="xhtml.Color.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.Cell.attrib" combine="interleave">
  <optional>
    <attribute name="nowrap">
      <value>nowrap</value>
    </attribute>
  </optional>
  <optional>
    <attribute name="bgcolor">
      <ref name="xhtml.Color.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="width">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
  <optional>
    <attribute name="height">
      <ref name="xhtml.Pixels.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.ul.attlist" combine="interleave">
  <optional>
    <attribute name="type"/>
  </optional>
  <optional>
    <attribute name="compact">
      <value>compact</value>
    </attribute>
  </optional>
</define>

<define name="xhtml.align.attrib">
  <optional>
    <attribute name="align">
      <choice>
	<value>left</value>
	<value>center</value>
	<value>right</value>
	<value>justify</value>
      </choice>
    </attribute>
  </optional>
</define>

<define name="xhtml.Color.datatype">
  <text/>
</define>

<define name="xhtml.Inline.class" combine="choice">
  <choice>
    <ref name="xhtml.font"/>
    <ref name="xhtml.basefont"/>
    <ref name="xhtml.s"/>
    <ref name="xhtml.strike"/>
    <ref name="xhtml.u"/>
  </choice>
</define>

<define name="xhtml.Block.class" combine="choice">
  <choice>
    <ref name="xhtml.center"/>
    <ref name="xhtml.isindex"/>
  </choice>
</define>

<define name="xhtml.List.class" combine="choice">
  <choice>
    <ref name="xhtml.dir"/>
    <ref name="xhtml.menu"/>
  </choice>
</define>

<define name="xhtml.head.content" combine="interleave">
  <optional>
    <ref name="xhtml.isindex"/>
  </optional>
</define>

<define name="xhtml.Block.mix" combine="choice">
  <choice>
    <text/>
    <ref name="xhtml.Inline.class"/>
  </choice>
</define>

<!-- With the legacy module and the frames modules, the html
     element can contain either body or frameset. -->
<define name="xhtml.frameset" combine="choice">
  <ref name="xhtml.body"/>
</define>

</grammar>

A.3.22. Ruby

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-ruby-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
     http://www.w3.org/MarkUp/RELAXNG/xhtml-ruby-1.rng

     Note that this module can select between 'simple' and 
     'complex' Ruby by integrating the 'Ruby.ruby.content.simple'
     or 'Ruby.ruby.content.complex' elements into the host language
     content model.

     .................................................................... -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

<define name="Ruby.ruby.content.simple">
  <group>
    <ref name="Ruby.rb"/>
    <choice>
      <ref name="Ruby.rt-simple"/>
      <group>
        <ref name="Ruby.rp"/>
        <ref name="Ruby.rt-simple"/>
        <ref name="Ruby.rp"/>
      </group>
    </choice>
  </group>
</define>

<define name="Ruby.ruby.content.complex">
  <group>
    <ref name="Ruby.rbc"/>
    <ref name="Ruby.rtc"/>
    <optional>
      <ref name="Ruby.rtc"/>
    </optional>
  </group>
</define>

<!-- default content model is simple -->
<define name="Ruby.ruby.content">
  <ref name="Ruby.ruby.content.simple"/>
</define>

<define name="Ruby.ruby">
  <element name="ruby">
    <ref name="Ruby.ruby.content"/>
    <ref name="Ruby.ruby.attlist"/>
  </element>
</define>

<define name="Ruby.ruby.attlist">
  <ref name="Ruby.Common.attrib"/>
</define>

<define name="Ruby.rbc">
  <element name="rbc">
    <ref name="Ruby.rbc.attlist"/>
    <oneOrMore>
      <ref name="Ruby.rb"/>
    </oneOrMore>
  </element>
</define>

<define name="Ruby.rbc.attlist">
  <ref name="Ruby.Common.attrib"/>
</define>

<define name="Ruby.rtc">
  <element name="rtc">
    <ref name="Ruby.rtc.attlist"/>
    <oneOrMore>
      <ref name="Ruby.rt-complex"/>
    </oneOrMore>
  </element>
</define>

<define name="Ruby.rtc.attlist">
  <ref name="Ruby.Common.attrib"/>
</define>

<define name="Ruby.rb">
  <element name="rb">
    <ref name="Ruby.rb.attlist"/>
    <ref name="Ruby.NoRuby.model"/>
  </element>
</define>

<define name="Ruby.rb.attlist">
  <ref name="Ruby.Common.attrib"/>
</define>

<define name="Ruby.rt-simple">
  <element name="rt">
    <ref name="Ruby.Common.attrib"/>
    <ref name="Ruby.NoRuby.model"/>
  </element>
</define>

<define name="Ruby.rt-complex">
  <element name="rt">
    <ref name="Ruby.NoRuby.model"/>
    <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>

<define name="Ruby.rp">
  <element name="rp">
    <ref name="Ruby.rp.attlist"/>
    <text/>
  </element>
</define>

<define name="Ruby.rp.attlist">
  <ref name="Ruby.Common.attrib"/>
</define>

<define name="Ruby.NoRuby.model" combine="choice">
  <ref name="xhtml.Inline.model"/>
</define>

<define name="Ruby.Common.attrib">
    <ref name="xhtml.Common.attrib"/>
</define>

</grammar>

A.4. XHTML RelaxNG Support Modules

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

A.4.1. Param

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-param-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-param-1.rng
     .................................................................... -->
<!-- Param Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.param">
  <element name="param">
    <ref name="xhtml.param.attlist"/>
  </element>
</define>

<define name="xhtml.param.attlist">
  <ref name="xhtml.id.attrib"/>
  <attribute name="name"/>
  <optional>
    <attribute name="value"/>
  </optional>
  <optional>
    <attribute name="valuetype">
      <choice>
	<value>data</value>
	<value>ref</value>
	<value>object</value>
      </choice>
    </attribute>
  </optional>
  <optional>
    <attribute name="type">
      <ref name="xhtml.ContentType.datatype"/>
    </attribute>
  </optional>
</define>

</grammar>

B. XHTML RelaxNG Language Implementations

This appendix is normative.

This appendix contains implementations of the currently defined W3C XHTML Family Markup Languages using RelaxNG.

B.1. XHTML 1.1

An implementation of XHTML 1.1 - Second Edition [XHTML11]:

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- XHTML Basic -->

<grammar ns="http://www.w3.org/1999/xhtml"
         xmlns="http://relaxng.org/ns/structure/1.0">

<include href="xhtml-datatypes-1.rng"/>
<include href="xhtml-attribs-1.rng"/>
<include href="xhtml-struct-1.rng"/>
<include href="xhtml-text-1.rng"/>
<include href="xhtml-hypertext-1.rng"/>
<include href="xhtml-list-1.rng"/>
<include href="xhtml-object-1.rng"/>
<include href="xhtml-param-1.rng"/>
<include href="xhtml-pres-1.rng"/>
<include href="xhtml-edit-1.rng"/>
<include href="xhtml-bdo-1.rng"/>
<include href="xhtml-form-1.rng"/>
<include href="xhtml-table-1.rng"/>
<include href="xhtml-image-1.rng"/>
<include href="xhtml-csismap-1.rng"/>
<include href="xhtml-ssismap-1.rng"/>
<include href="xhtml-events-1.rng"/>
<include href="xhtml-meta-1.rng"/>
<include href="xhtml-script-1.rng"/>
<include href="xhtml-style-1.rng"/>
<include href="xhtml-inlstyle-1.rng"/>
<include href="xhtml-link-1.rng"/>
<include href="xhtml-base-1.rng"/>
<include href="xhtml-ruby-1.rng"/>

<define name="xhtml.lang.attrib" combine="interleave">
  <optional>
    <attribute name="lang">
      <ref name="xhtml.LanguageCode.datatype"/>
    </attribute>
  </optional>
</define>

</grammar>

B.2. XHTML Basic 1.1

An implementation of XHTML Basic 1.1 - Second Edition [XHTMLBASIC]:

<!-- XHTML Basic -->

<grammar ns="http://www.w3.org/1999/xhtml"
         xmlns="http://relaxng.org/ns/structure/1.0">

<include href="xhtml-datatypes-1.rng"/>
<include href="xhtml-attribs-1.rng"/>
<include href="xhtml-struct-1.rng"/>
<include href="xhtml-text-1.rng"/>
<include href="xhtml-hypertext-1.rng"/>
<include href="xhtml-list-1.rng"/>
<include href="xhtml-basic-form-1.rng"/>
<include href="xhtml-basic-table-1.rng"/>
<include href="xhtml-image-1.rng"/>
<include href="xhtml-param-1.rng"/>
<include href="xhtml-object-1.rng"/>
<include href="xhtml-meta-1.rng"/>
<include href="xhtml-link-1.rng"/>
<include href="xhtml-base-1.rng"/>
<include href="xhtml-inputmode-1.rng"/>

<define name="xhtml.lang.attrib" combine="interleave">
  <optional>
    <attribute name="lang">
      <ref name="xhtml.LanguageCode.datatype"/>
    </attribute>
  </optional>
</define>

</grammar>

B.2.1. Supporting Modules

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-inputmode-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-inputmode-1.rng
     .................................................................... -->
<!-- Inputmode Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.InputMode.datatype">
  <text/>
</define>

<!-- inputmode -->
<define name="xhtml.inputmode.attrib">
  <optional>
    <attribute name="inputmode">
      <ref name="xhtml.InputMode.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.input.attlist" combine="interleave">
  <ref name="xhtml.inputmode.attrib"/>
</define>

<define name="xhtml.textarea.attlist" combine="interleave">
  <ref name="xhtml.inputmode.attrib"/>
</define>

</grammar>

B.3. XHTML Print

An implementation of XHTML Print - Second Edition [XHTMLPRINT]:

<!-- XHTML Print -->

<grammar ns="http://www.w3.org/1999/xhtml"
         xmlns="http://relaxng.org/ns/structure/1.0">

<include href="xhtml-datatypes-1.rng"/>
<include href="xhtml-attribs-1.rng"/>
<include href="xhtml-struct-1.rng"/>
<include href="xhtml-text-1.rng"/>
<include href="xhtml-hypertext-1.rng"/>
<include href="xhtml-list-1.rng"/>
<include href="xhtml-pres-1.rng"/>
<include href="xhtml-basic-form-1.rng"/>
<include href="xhtml-basic-table-1.rng"/>
<include href="xhtml-image-1.rng"/>
<include href="xhtml-param-1.rng"/>
<include href="xhtml-object-1.rng"/>
<include href="xhtml-meta-1.rng"/>
<include href="xhtml-script-1.rng"/>
<include href="xhtml-style-1.rng"/>
<include href="xhtml-inlstyle-1.rng"/>
<include href="xhtml-link-1.rng"/>
<include href="xhtml-base-1.rng"/>

</grammar>

B.4. XHTML+RDFa 1.0

An implementation of XHTML+RDFa 1.0 [XHTMLRDFA]:

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- XHTML+RDFa 1.0 -->

<grammar ns="http://www.w3.org/1999/xhtml"
         xmlns="http://relaxng.org/ns/structure/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

<include href="xhtml-datatypes-1.rng"/>
<include href="xhtml-attribs-1.rng"/>
<include href="xhtml-text-1.rng"/>
<include href="xhtml-list-1.rng"/>
<include href="xhtml-object-1.rng"/>
<include href="xhtml-pres-1.rng"/>
<include href="xhtml-edit-1.rng"/>
<include href="xhtml-bdo-1.rng"/>
<include href="xhtml-form-1.rng"/>
<include href="xhtml-table-1.rng"/>
<include href="xhtml-image-1.rng"/>
<include href="xhtml-ssismap-1.rng"/>
<include href="xhtml-events-1.rng"/>
<include href="xhtml-inlstyle-1.rng"/>
<include href="xhtml-base-1.rng"/>
<include href="xhtml-ruby-1.rng"/>
<include href="xhtml-metaAttributes-1.rng"/>

<define name="xhtml.Common.attrib" combine="interleave">
  <optional>
    <attribute name="href">
      <ref name="xhtml.URI.datatype"/>
    </attribute>
  </optional>
  <ref name="xhtml.Metainformation.attrib"/>
</define>

<include href="xhtml-hypertext-1.rng">
	<define name="xhtml.a.attlist">
	  <ref name="xhtml.Common.attrib"/>
	  <optional>
		<attribute name="charset">
		  <ref name="xhtml.Charset.datatype"/>
		</attribute>
	  </optional>
	  <optional>
		<attribute name="type">
		  <ref name="xhtml.ContentType.datatype"/>
		</attribute>
	  </optional>
	  <optional>
		<attribute name="hreflang">
		  <ref name="xhtml.LanguageCode.datatype"/>
		</attribute>
	  </optional>
	  <optional>
		<attribute name="accesskey">
		  <ref name="xhtml.Character.datatype"/>
		</attribute>
	  </optional>
	  <optional>
		<attribute name="tabindex">
		  <ref name="xhtml.Number.datatype"/>
		</attribute>
	  </optional>
	</define>
</include>

<include href="xhtml-link-1.rng">
	<define name="xhtml.link.attlist">
	  <ref name="xhtml.Common.attrib"/>
	  <optional>
		<attribute name="charset">
		  <ref name="xhtml.Charset.datatype"/>
		</attribute>
	  </optional>
	  <optional>
		<attribute name="hreflang">
		  <ref name="xhtml.LanguageCode.datatype"/>
		</attribute>
	  </optional>
	  <optional>
		<attribute name="type">
		  <ref name="xhtml.ContentType.datatype"/>
		</attribute>
	  </optional>
	  <optional>
		<attribute name="media">
		  <ref name="xhtml.MediaDesc.datatype"/>
		</attribute>
	  </optional>
	</define>
</include>

<include href="xhtml-meta-1.rng">
	<define name="xhtml.meta.attlist">
	  <ref name="xhtml.Common.attrib"/>
	  <optional>
		<attribute name="http-equiv">
		  <data type="NMTOKEN"/>
		</attribute>
	  </optional>
	  <optional>
		<attribute name="name">
		  <data type="NMTOKEN"/>
		</attribute>
	  </optional>
	  <optional>
		<attribute name="scheme">
		  <text/>
		</attribute>
	  </optional>
	</define>
</include>

<include href="xhtml-script-1.rng">
	<define name="xhtml.script.attlist">
	  <ref name="xhtml.id.attrib"/>
	  <ref name="xhtml.Metainformation.attrib"/>
	  <optional>
		<attribute name="href">
		  <ref name="xhtml.URI.datatype"/>
		</attribute>
	  </optional>
	  <optional>
		<attribute name="charset">
		  <ref name="xhtml.Charset.datatype"/>
		</attribute>
	  </optional>
	  <attribute name="type">
		<ref name="xhtml.ContentType.datatype"/>
	  </attribute>
	  <optional>
		<attribute name="src">
		  <ref name="xhtml.URI.datatype"/>
		</attribute>
	  </optional>
	  <optional>
		<attribute name="defer">
		  <value>defer</value>
		</attribute>
	  </optional>
	  <optional>
		<attribute name="xml:space">
		  <value>preserve</value>
		</attribute>
	  </optional>
	</define>
</include>

<include href="xhtml-style-1.rng">
	<define name="xhtml.style.attlist">
	  <ref name="xhtml.title.attrib"/>
	  <ref name="xhtml.I18n.attrib"/>
	  <ref name="xhtml.id.attrib"/>
	  <ref name="xhtml.Metainformation.attrib"/>
	  <optional>
		<attribute name="href">
		  <ref name="xhtml.URI.datatype"/>
		</attribute>
	  </optional>
	  <attribute name="type">
		<ref name="xhtml.ContentType.datatype"/>
	  </attribute>
	  <optional>
		<attribute name="media">
		  <ref name="xhtml.MediaDesc.datatype"/>
		</attribute>
	  </optional>
	  <!-- <optional>
		<attribute name="xml:space">
		  <value>preserve</value>
		</attribute>
	  </optional> -->
	</define>
</include>

<include href="xhtml-csismap-1.rng">
	<define name="xhtml.area.attlist">
	  <ref name="xhtml.Common.attrib"/>
	  <ref name="xhtml.shape.attrib"/>
	  <ref name="xhtml.coords.attrib"/>
	  <optional>
		<attribute name="nohref">
		  <value>nohref</value>
		</attribute>
	  </optional>
	  <attribute name="alt">
		<ref name="xhtml.Text.datatype"/>
	  </attribute>
	  <optional>
		<attribute name="tabindex">
		  <ref name="xhtml.Number.datatype"/>
		</attribute>
	  </optional>
	  <optional>
		<attribute name="accesskey">
		  <ref name="xhtml.Character.datatype"/>
		</attribute>
	  </optional>
	</define>
</include>

<include href="xhtml-param-1.rng">
	<define name="xhtml.param.attlist">
	  <ref name="xhtml.id.attrib"/>
	  <ref name="xhtml.Metainformation.attrib"/>
	  <optional>
		<attribute name="href">
		  <ref name="xhtml.URI.datatype"/>
		</attribute>
	  </optional>
	  <attribute name="name"/>
	  <optional>
		<attribute name="value"/>
	  </optional>
	  <optional>
		<attribute name="valuetype">
		  <choice>
		<value>data</value>
		<value>ref</value>
		<value>object</value>
		  </choice>
		</attribute>
	  </optional>
	  <optional>
		<attribute name="type">
		  <ref name="xhtml.ContentType.datatype"/>
		</attribute>
	  </optional>
	</define>
</include>

<include href="xhtml-struct-1.rng">
	<define name="xhtml.title.attlist">
	  <ref name="xhtml.Common.attrib"/>
	</define>

	<define name="xhtml.head.attlist">
	  <ref name="xhtml.Common.attrib"/>
	  <ref name="xhtml.profile.attlist"/>
	</define>

	<define name="xhtml.html.attlist">
	  <ref name="xhtml.XHTML.version.attrib"/>
	  <ref name="xhtml.Common.attrib"/>
	</define>
</include>

</grammar>

B.4.1. Supporting Modules

<?xml version="1.0" encoding="iso-8859-1"?>

<!-- file: xhtml-metaAttributes-1.rng

     This is XHTML, a reformulation of HTML as a modular XML application.
     Copyright 1998-2010 W3C (MIT, ERCIM, Keio), All Rights Reserved.
     Revision: $Id: Overview.html,v 1.3 2010/12/17 20:50:29 smccarro Exp $

     This RelaxNG module is identified by URI:
        
        http://www.w3.org/MarkUp/RELAXNG/xhtml-metaAttributes-1.rng
     .................................................................... -->
<!-- MetaInformation Attributes Module -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0">

<define name="xhtml.about.attrib">
  <optional>
    <attribute name="about">
      <ref name="xhtml.URIorSafeCURIE.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.typeof.attrib">
  <optional>
    <attribute name="typeof">
      <ref name="xhtml.CURIEs.datatype"/>
    </attribute>
  </optional>
</define>

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

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

<define name="xhtml.content.attrib">
  <optional>
    <attribute name="content">
      <text/>
    </attribute>
  </optional>
</define>

<define name="xhtml.datatype.attrib">
  <optional>
    <attribute name="datatype">
      <ref name="xhtml.CURIE.datatype"/>
    </attribute>
  </optional>
</define>

<define name="xhtml.rel.attrib">
  <optional>
    <attribute name="rel">
      <ref name="xhtml.CURIEs.datatype"/>
    </attribute>
  </optional>
</define>

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

<define name="xhtml.Metainformation.attrib" combine="interleave">
  <ref name="xhtml.about.attrib"/>
  <ref name="xhtml.content.attrib"/>
  <ref name="xhtml.datatype.attrib"/>
  <ref name="xhtml.typeof.attrib"/>
  <ref name="xhtml.property.attrib"/>
  <ref name="xhtml.rel.attrib"/>
  <ref name="xhtml.resource.attrib"/>
  <ref name="xhtml.rev.attrib"/>
</define>

</grammar>

C. References

C.1. Normative References

This section is normative.

[RFC2119]
"Key words for use in RFCs to indicate requirement levels", RFC 2119, S. Bradner, March 1997.
Available at: http://www.rfc-editor.org/rfc/rfc2119.txt
[RELAXNG]
"RELAX NG Specification", OASIS Committee Specification, J. Clark, Murata M., eds., 3 December 2001.
Available at: http://relaxng.org/spec-20011203.html
RELAX NG has been standardized as part of ISO/IEC 19757 - Document Schema Definition Languages (DSDL), as ISO/IEC 19757-2:2003 "Information technology -- Document Schema Definition Language (DSDL) -- Part 2: Regular-grammar-based validation -- RELAX NG". See home page for Document Schema Definition Languages at http://dsdl.org/ for details.
[XHTMLMOD]
"Modularization of XHTML™ 1.1", W3C Recommendation, S. McCarron et al., eds., 29 July 2010.
Available at: http://www.w3.org/TR/2010/REC-xhtml-modularization-20100729
The latest version is available at: http://www.w3.org/TR/xhtml-modularization
[XHTML11]
"XHTML 1.1 - Module-based XHTML - Second Edition", W3C Recommendation, S. McCarron, 23 November 2010.
Available at: http://www.w3.org/TR/2010/REC-xhtml11-20101123/.
[XHTMLBASIC]
"XHTML Basic 1.1 - Second Edition", W3C Recommendation, S. McCarron, 23 November 2010.
Available at: http://www.w3.org/TR/2010/REC-xhtml-basic-20101123/.
[XHTMLPRINT]
"XHTML Print- Second Edition", W3C Recommendation, S. McCarron, 23 November 2010.
Available at: http://www.w3.org/TR/2010/REC-xhtml-print-20101123/.
[XHTMLRDFA]
"RDFa in XHTML: Syntax and Processing", W3C Recommendation, B. Adida, et. al., 14 October 2008.
Available at: http://www.w3.org/TR/2008/REC-rdfa-syntax-20081014.
[RELAXNGXHTML]
"Modularization of XHTML in RELAX NG", J. Clark.
Available at: http://www.thaiopensource.com/relaxng/xhtml/.
[XMLNAMES]
"Namespaces in XML (Second Edition)", W3C Recommendation, T. Bray, D. Hollander, A. Layman, eds., 17 August 2006.
Available at: http://www.w3.org/TR/2006/REC-xml-names-20060816

C.2. Other References

[CSS2]
"Cascading Style Sheets, level 2 (CSS2) Specification", W3C Recommendation, B. Bos, H. W. Lie, C. Lilley, I. Jacobs, eds., 12 May 1998.
Available at: http://www.w3.org/TR/1998/REC-CSS2-19980512
[DOM]
"Document Object Model (DOM) Level 1 Specification", L. Wood et al., 1 October 1998.
Available at: http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001
[MATHML]
"Mathematical Markup Language (MathML) Version 2.0 (Second Edition)", W3C Recommendation, D. Carlisle, P. Ion, R. Miner, N. Poppelie, eds., 21 October 2003.
Available at: http://www.w3.org/TR/2003/REC-MathML2-20031021/
[SMIL]
"Synchronized Multimedia Integration Language", W3C Recommendation, D. Bulterman et al., eds.
Available at: http://www.w3.org/TR/SMIL/

D. Acknowledgments

This section is informative.

This document was prepared by the W3C XHTML2 Working Group. The members at the time of publication of the Note were: