This section is normative.
As its name suggests, the List Module provides list-oriented elements. Specifically, the List Module supports the following elements and attributes:
|dl||Common||label?, (( dt | dd)+ | di+)|
|di||Common||( dt+, dd*)|
|dt||Common||(PCDATA | Text)*|
|dd||Common||(PCDATA | Flow)*|
|label||Common||(PCDATA | Text)*|
|nl||Common||label , li+|
|li||Common, value||(PCDATA | Flow)*|
This module also defines the content set List with the content model (dl | nl | ol | ul)+ and adds this set to the Flow content set of the Structural Module.
Implementation: RELAX NG
XHTML offers authors several mechanisms for specifying lists of information. Lists may contain:
The previous list, for example, is an unordered list, created with the ul element:
<ul> <li>Unordered information. </li> <li>Ordered information. </li> <li>Navigation information. </li> <li>Definitions. </li> </ul>
An ordered list, created using the ol element, contains information where order is important, as in a recipe:
Definition lists, created using the dl element, generally consist of a series of term/definition pairs (although definition lists may have other applications). Thus, when advertising a product, one might use a definition list:
defined in XHTML as:
<dl> <dt>Lower cost</dt> <dd>The new version of this product costs significantly less than the previous one!</dd> <dt>Easier to use</dt> <dd>We've changed the product so that it's much easier to use!</dd> <dt>Safe for kids</dt> <dd>You can leave your kids alone in a room with this product and they won't get hurt (not a guarantee).</dd> </dl>
Definition lists vary only slightly from other types of lists in that list items consist of two parts: a term and a description. The term is given by the dt element. The description is given with a dd element. The term and its definition can be grouped within a di element to help clarify the relationship between a term and its definition(s).
<dl> <di> <dt>Dweeb</dt> <dd>young excitable person who may mature into a <em>Nerd</em> or <em>Geek</em></dd> </di> <di> <dt>Hacker</dt> <dd>a clever programmer</dd> </di> <di> <dt>Nerd</dt> <dd>technically bright but socially inept person</dd> </di> </dl>
Here is an example with multiple terms and descriptions:
<dl> <dt>Center</dt> <dt>Centre</dt> <dd> A point equidistant from all points on the surface of a sphere.</dd> <dd> In some field sports, the player who holds the middle position on the field, court, or forward line.</dd> </dl>
Navigation lists are intended to be used to define collections of selectable items for presentation in a "navigation" menu. Note that a navigation list always starts with a label element that defines the label for the list.
Basic navigation list structure
<nl> <label>Contents </label> <li href="#introduction">Introduction</li> <li> <nl> <label>Terms</label> <li href="#may">May</li> <li href="#must">Must</li> <li href="#should">Should</li> </nl> </li> <li href="#conformance">Conformance</li> <li href="#references">References</li> ... </nl>
User agents MUST by default number ordered list items. User agents must not by default number unordered list items.
Both types of lists are made up of sequences of list items defined by the li element.
Basic list structure
<ul> <li>... first list item...</li> <li>... second list item...</li> ... </ul>
The li element defines a list item within an ordered, unordered, or navigation list.
Within a list, each
li element has an associated number, which is used for numbering list items in ordered lists:
lielement has a
valueattribute, the associated number is the value of that attribute;
lielement is the first in the list, then the number has the value 1;
liin the same list.
The label element is used to define a label for a list. The contents of the label element represent the title of a list (or sublist).
Navigation Lists PR #7662
[XHTML2] 11.3. The ol , and ul elements PR #7663
WD-xhtml2-20040722: Some navigation list requirements (IMHO) PR #7664