9. XHTML Text Module

Contents

This section is normative.

This module defines all of the basic text container elements, attributes, and their content models that are "inline level". Note that while the concept of "inline level" can be construed as a presentation aspect, in this case it is intended to only have a semantic meaning.

Element Attributes Content Model
abbr Common, full (PCDATA | Text)*
cite Common (PCDATA | Text)*
code Common (PCDATA | Text)*
dfn Common (PCDATA | Text)*
em Common (PCDATA | Text)*
kbd Common (PCDATA | Text)*
l Common (PCDATA | Text)*
q Common (PCDATA | Text)*
samp Common (PCDATA | Text)*
span Common (PCDATA | Text)*
strong Common (PCDATA | Text)*
sub Common (PCDATA | Text)*
sup Common (PCDATA | Text)*
var Common (PCDATA | Text)*

l element content model

Content model of the l element should not allow nested lines

The content model for this module defines a content set:

Text
abbr | cite | code | dfn | em | kbd | link | meta | object | q | ruby | samp | span | strong | var | XForms_Form_Controls

Implementation: RELAX NG

9.1. The abbr element

The abbr element indicates that a text fragment is an abbreviation (e.g., W3C, XML, Inc., Ltd., Mass., etc.); this includes acronyms.

Attributes

The Common collection
A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, and Metainformation.
full = IDREF
This attribute locates an element that defines the full expansion of an abbreviation. The referenced element must be in the same document as the abbreviation.

The content of the abbr element specifies the abbreviated expression itself, as it would normally appear in running text. The title or full attributes may be used to provide the full or expanded form of the expression. Such an attribute should be repeated each time the abbreviation is defined in the document.

Examples

<abbr title="Limited">Ltd.</abbr>
<abbr title="Abbreviation">abbr.</abbr>
<p>The <span id="w3c">World Wide Web Consortium</span> (<abbr full="#w3c">W3C</abbr>)
   develops interoperable technologies (specifications, guidelines, software, and tools)
   to lead the Web to its full potential. <abbr full="#w3c">W3C</abbr> is a forum for
   information, commerce, communication, and collective understanding.</p>

9.2. The cite element

The cite element contains a citation or a reference to other sources.

Attributes

The Common collection
A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, and Metainformation.

In the following example, the cite element is used to reference the book from which the quotation is taken:

cite as book reference

As Gandalf the White said in 
<cite cite="http://www.example.com/books/the_two_towers">The Two Towers</cite>,
<quote xml:lang="en">"The hospitality of 
your hall is somewhat lessened of late, Theoden King."</quote>

cite to reference another specification

More information can be found in 
<cite cite="http://www.w3.org/TR/REC-xml">[XML]</cite>.

9.3. The code element

The code element contains a fragment of computer code.

Attributes

The Common collection
A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, and Metainformation.

Example

The Pascal statement <code>i := 1;</code> assigns the
literal value one to the variable <var>i</var>.

9.4. The dfn element

The dfn element contains the defining instance of the enclosed term.

Attributes

The Common collection
A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, and Metainformation.

Example

<p role="definition">
    An <dfn id="def-acronym">acronym</dfn> is a word
    formed from the initial letters or groups of letters of words in a 
    set phrase or series of words.
</p>

9.5. The em element

The em element indicates emphasis for its contents.

Attributes

The Common collection
A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, and Metainformation.

Example

Do <em>not</em> phone before 9 a.m.

9.6. The kbd element

The kbd element indicates input to be entered by the user.

Attributes

The Common collection
A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, and Metainformation.

Example

To exit, type <kbd>QUIT</kbd>.

9.7. The l element

The l element represents a semantic line of text (e.g., a line of verse or a line of computer code).

Attributes

The Common collection
A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, and Metainformation.

By retaining structure in text that has to be broken over lines, you retain essential information about its makeup. This gives you greater freedom with styling the content. For instance, line numbers can be generated automatically from the style sheet if needed.

Sample program listing

<blockcode class="program">
<l>program p(input, output);</l>
<l>begin</l>
<l>   writeln("Hello world");</l>
<l>end.</l>
</blockcode>

CSS Style sheet to number each line

.program { counter-reset: linenumber }

l:before {
    position: relative;
    left: -1em;
    counter-increment: linenumber;
    content: counter(linenumber);
}

9.8. The q element

This element designates an inline text fragment of quoted text.

Attributes

The Common collection
A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, and Metainformation.

Visual user agents must not by default add delimiting quotation marks (as was the case for the q element in earlier versions of XHTML and HTML). It is the responsibility of the document author to add any required quotation marks, either directly in the text, or via a style sheet.

Nested quotations using q

<p>John said, <q>"I saw Lucy at lunch, she told me
<q>'Mary wants you
to get some ice cream on your way home.'</q> I think I will get
some at Jen and Berry's, on Gloucester Road."</q></p>

q with a cite attribute

Steven replied:
<q cite="http://lists.example.org/2002/01.html">We quite agree</q>

9.9. The samp element

The samp element designates sample output from programs, scripts, etc.

Attributes

The Common collection
A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, and Metainformation.

Example

On starting, you will see the prompt <samp>$ </samp>.

9.10. The span element

The span element, in conjunction with the id, class and role attributes, offers a generic mechanism for adding structure to documents. This element imposes no presentational idioms on the content. Thus, authors may use this element in conjunction with style sheets, the xml:lang attribute, the dir attribute etc., to tailor XHTML to their own needs and tastes.

Attributes

The Common collection
A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, and Metainformation.

Example of span for cross references

<p>This operation is called
the <span class="xref">transpose</span>
or <span class="xref">inverse</span>.</p>

9.11. The strong element

The strong element indicates higher importance for its contents than that of the surrounding content.

Attributes

The Common collection
A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, and Metainformation.

Example

On <strong>Monday</strong> please put the rubbish out,
but <em>not</em> before nightfall!

9.12. The sub element

The sub element indicates that its contents should regarded as a subscript.

Attributes

The Common collection
A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, and Metainformation.

Example

      H<sub >2</sub>O

9.13. The sup element

The sup element indicates that its contents should be regarded as a super-script.

Attributes

The Common collection
A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, and Metainformation.

Many scripts (e.g., French) require superscripts or subscripts for proper rendering. The sub and sup elements should be used to markup text in these cases.

Example

      E = mc<sup>2</sup>
      <span xml:lang="fr">M<sup>lle</sup> Dupont</span>

9.14. The var element

The var element indicates an instance of a variable or program argument.

Attributes

The Common collection
A collection of other attribute collections, including: Bi-directional, Core, Edit, Embedding, Events, Forms, Hypertext, I18N, Map, and Metainformation.

Example

The parameter <var>ncols</var> represents
the number of colors to use.

9.15. Issues

PCData not in Text PR #7876
State: Open
Resolution: None
User: None

Notes:
The group agrees that we should change the abstract module definitions such that PCDATA is just included in Text.

XHTML 2.0: Text Module/<l> vs. <br /> element PR #7882
State: Open
Resolution: None
User: None

Notes:
The working group cannot come up with an example. Requesting one from the submitter.

RE: [ off list ] XHTML 2.0 - dfn : Content model and usability PR #7885
State: Open
Resolution: None
User: None

Notes:

Re: [XHTML 2.0] emphesis PR #7899
State: Approved
Resolution: Accepted
User: None

Notes:
The working group has agreed that nested "em" elements should indicate higher emphasis. This will be reflected in the text in a future draft.