# 4. Defining Abstract Modules

Contents

This section is normative.

An abstract module is a definition of an XHTML module using prose text and some informal markup conventions. While such a definition is not generally useful in the machine processing of document types, it is critical in helping people understand what is contained in a module. This section defines the way in which XHTML abstract modules are defined. An XHTML-conforming module is not required to provide an abstract module definition. However, anyone developing an XHTML module is encouraged to provide an abstraction to ease in the use of that module.

## 4.1. Syntactic Conventions

The abstract modules are not defined in a formal grammar. However, the definitions do adhere to the following syntactic conventions. These conventions are similar to those of XML DTDs, and should be familiar to XML DTD authors. Each discrete syntactic element can be combined with others to make more complex expressions that conform to the algebra defined here.

element name
  When an element is included in a content model, its explicit name will be listed.
content set
  Some modules define lists of explicit element names called content sets. When a content set is included in a content model, its name will be listed.
`expr ?`
  Zero or one instances of expr are permitted.
`expr +`
  One or more instances of expr are required.
`expr *`
  Zero or more instances of expr are permitted.
`a , b`
  Expression `a` is required, followed by expression `b`.
`a | b`
  Either expression a or expression b is required.
`a - b`
  Expression a is permitted, omitting elements in expression b.
parentheses
  When an expression is contained within parentheses, evaluation of any subexpressions within the parentheses take place before evaluation of expressions outside of the parentheses (starting at the deepest level of nesting first).
extending pre-defined elements
  In some instances, a module adds attributes to an element. In these instances, the element name is followed by an ampersand (`&`).
defining required attributes
  When an element requires the definition of an attribute, that attribute name is followed by an asterisk (`*`).
defining the type of attribute values
  When a module defines the type of an attribute value, it does so by listing the type in parentheses after the attribute name.
defining the legal values of attributes
  When a module defines the legal values for an attribute, it does so by listing the explicit legal values (enclosed in quotation marks), separated by vertical bars (`|`), inside of parentheses following the attribute name. If the attribute has a default value, that value is followed by an asterisk (`*`). If the attribute has a fixed value, the attribute name is followed by an equals sign (`=`) and the fixed value enclosed in quotation marks.

## 4.2. Content Types

Abstract module definitions define minimal, atomic content models for each module. These minimal content models reference the elements in the module itself. They may also reference elements in other modules upon which the abstract module depends. Finally, the content model in many cases requires that text be permitted as content to one or more elements. In these cases, the symbol used for text is PCDATA; this is short for "parsed character data", denoting sequences of characters which are to be parsed for markup by an XML processor .(processed character data). A content type can also be defined as EMPTY, meaning the element has no content in its minimal content model.

## 4.3. Attribute Types

In some instances, it is necessary to define the types of attribute values or the explicit set of permitted values for attributes. The following attribute types (defined in the XML 1.0 Recommendation) are used in the definitions of the abstract modules:

Attribute Type | Definition
--- | ---
CDATA | Character data
ID | A document-unique identifier
IDREF | A reference to a document-unique identifier
IDREFS | A space-separated list of references to document-unique identifiers
NAME | A name with the same character constraints as ID above
NMTOKEN | A name composed of only name tokens as defined in XML 1.0 [XML]
NMTOKENS | One or more white space separated NMTOKEN values

In addition to these pre-defined data types, XHTML Modularization defines the following data types and their semantics (as appropriate):

Data type | Description
--- | ---
Character | A single character from [ISO10646].
Charset | A character encoding, as per [RFC2045].
Charsets | A space-separated list of character encodings, as per [RFC2045].
Color | The attribute value type "Color" refers to color definitions as specified in [SRGB]. A color value may either be a hexadecimal number (prefixed by a hash mark) or one of the following sixteen color names. The color names are case-insensitive.
Color names and sRGB values
| Black = "#000000" |  | Green = "#008000"
| Silver = "#C0C0C0" |  | Lime = "#00FF00"
| Gray = "#808080" |  | Olive = "#808000"
| White = "#FFFFFF" |  | Yellow = "#FFFF00"
| Maroon = "#800000" |  | Navy = "#000080"
| Red = "#FF0000" |  | Blue = "#0000FF"
| Purple = "#800080" |  | Teal = "#008080"
| Fuchsia = "#FF00FF" |  | Aqua = "#00FFFF"
Thus, the color values "#800080" and "Purple" both refer to the color purple.
ContentType | A media type, as per [RFC2045].
ContentTypes | A comma-separated list of media types, as per [RFC2045].
Coords | Comma separated list of coordinates to use in defining areas.
Datetime | Date and time information.
FPI | A character string representing an SGML Formal Public Identifier.
FrameTarget | Frame name used as destination for results of certain actions.
LanguageCode | A language code, as per [RFC3066] or its successor.
LanguageCodes | A comma-separated list of language ranges with optional q parameters, as defined in section 14.4 of [RFC2616] as the field value of the Accept-Language request header. Individual language codes should conform to [RFC3066] or its successors.
Length | The value may be either in pixels or a percentage of the available horizontal or vertical space. Thus, the value "50%" means half of the available space.
LinkTypes | Authors may use the following recognized link types, listed here with their conventional interpretations. A LinkTypes value refers to a space-separated list of link types. White space characters are not permitted within link types. These link types are case-insensitive, i.e., "Alternate" has the same meaning as "alternate". User agents, search engines, etc. may interpret these link types in a variety of ways. For example, user agents may provide access to linked documents through a navigation bar. Alternate Designates substitute versions for the document in which the link occurs. When used together with the `hreflang` attribute, it implies a translated version of the document. When used together with the `media` attribute, it implies a version designed for a different medium (or media). Stylesheet Refers to an external style sheet. See the Style Module for details. This is used together with the link type "Alternate" for user-selectable alternate style sheets. Start Refers to the first document in a collection of documents. This link type tells search engines which document is considered by the author to be the starting point of the collection. Next Refers to the next document in a linear sequence of documents. User agents may choose to pre-load the "next" document, to reduce the perceived load time. Prev Refers to the previous document in an ordered series of documents. Some user agents also support the synonym "Previous". Contents Refers to a document serving as a table of contents. Some user agents also support the synonym ToC (from "Table of Contents"). Index Refers to a document providing an index for the current document. Glossary Refers to a document providing a glossary of terms that pertain to the current document. Copyright Refers to a copyright statement for the current document. Chapter Refers to a document serving as a chapter in a collection of documents. Section Refers to a document serving as a section in a collection of documents. Subsection Refers to a document serving as a subsection in a collection of documents. Appendix Refers to a document serving as an appendix in a collection of documents. Help Refers to a document offering help (more information, links to other sources information, etc.) Bookmark Refers to a bookmark. A bookmark is a link to a key entry point within an extended document. The title attribute may be used, for example, to label the bookmark. Note that several bookmarks may be defined in each document. Authors may wish to define additional link types not described in this specification. If they do so, they should use a profile to cite the conventions used to define the link types. Please see the profile attribute of the head element for more information. Note that in a future version of this specification, the Working Group expects to evolve this type from a simple name to a Qualified Name (QName).
1. MediaDesc | The MediaDesc attribute is a comma-separated list of media descriptors. The following is a list of recognized media descriptors: screen Intended for non-paged computer screens. tty Intended for media using a fixed-pitch character grid, such as teletypes, terminals, or portable devices with limited display capabilities. tv Intended for television-type devices (low resolution, color, limited scrollability). projection Intended for projectors. handheld Intended for handheld devices (small screen, monochrome, bitmapped graphics, limited bandwidth). print Intended for paged, opaque material and for documents viewed on screen in print preview mode. braille Intended for braille tactile feedback devices. aural Intended for speech synthesizers. all Suitable for all devices. Future versions of XHTML may introduce new values and may allow parameterized values. To facilitate the introduction of these extensions, conforming user agents must be able to parse the media attribute value as follows: The value is a comma-separated list of entries. For example,
       media="screen, 3d-glasses, print and resolution > 90dpi"
   is mapped to:
       "screen"
       "3d-glasses"
       "print and resolution > 90dpi"
2. Each entry is truncated just before the first character that isn't a US ASCII letter [a-zA-Z] (ISO 10646 hex 41-5a, 61-7a), digit [0-9] (hex 30-39), or hyphen-minus (hex 2d). In the example, this gives:
       "screen"
       "3d-glasses"
       "print"
A case-insensitive match is then made with the set of media types defined above. User agents may ignore entries that don't match. In the example we are left with `screen` and `print`. Note. Style sheets may include media-dependent variations within them (e.g., the CSS @media construct). In such cases it may be appropriate to use "media =all".
MultiLength | The value may be a Length or a relative length. A relative length has the form "i*", where "i" is an integer. When allotting space among elements competing for that space, user agents allot pixel and percentage lengths first, then divide up remaining available space among relative lengths. Each relative length receives a portion of the available space that is proportional to the integer preceding the "*". The value "*" is equivalent to "1*". Thus, if 60 pixels of space are available after the user agent allots pixel and percentage space, and the competing relative lengths are 1*, 2*, and 3*, the 1* will be allotted 10 pixels, the 2* will be allotted 20 pixels, and the 3* will be allotted 30 pixels.
MultiLengths | A comma separated list of items of type MultiLength.
Number | One or more digits
Pixels | The value is an integer that represents the number of pixels of the canvas (screen, paper). Thus, the value "50" means fifty pixels. For normative information about the definition of a pixel, please consult [CSS2]
QName | An [XMLNS]-qualified name. See QName for a formal definition.
QNames | A space-separated list of QNames, as defined above.
Script | Script data can be the content of the "script" element and the value of intrinsic event attributes. User agents must not evaluate script data as HTML markup but instead must pass it on as data to a script engine. The case-sensitivity of script data depends on the scripting language. Please note that script data that is element content may not contain character references, but script data that is the value of an attribute may contain them.
Shape | The shape of a region.
Text | Arbitrary textual data, likely meant to be human-readable.
URI | A Uniform Resource Identifier Reference, as defined by the type `anyURI` in XMLSCHEMA.
URIs | A space-separated list of URIs as defined above.
URIREF | A relative URI consisting of only an initial '#' and a fragment identifier.

## 4.4. An Example Abstract Module Definition

This section is informative

This section defines a sample abstract module as an example of how to take advantage of the syntax rules defined above. Since this example is trying to use all of the various syntactic elements defined, it is pretty complicated. Typical module definitions would be much simpler than this. Finally, note that this module references the attribute collection Common. This is a collection defined in the XHTML Modularization specification that includes all of the basic attributes that most elements need.

### 4.4.1. XHTML Skiing Module

The XHTML Skiing Module defines markup used when describing aspects of a ski lodge. The elements and attributes defined in this module are:

Elements | Attributes | Minimal Content Model
--- | --- | ---
resort | Common, href (CDATA) | description, Aspen+
lodge | Common | description, (Aspen - lift)+
lift | Common, href | description?
chalet | Common, href | description?
room | Common, href | description?
lobby | Common, href | description?
fireplace | Common, href | description?
description | Common | PCDATA*

This module also defines the content set Aspen with the minimal content model lodge | lift | chalet | room | lobby | fireplace.