This page details the Attribute Types which are applicable to the standard
*XHTML 1.1 DTD
covered on this site. Those Attribute Types which apply only to Modules which are not included in the DTD (e.g. Legacy Module,
Frames Module) are not listed below.
The following types are defined in the XML 1.0 Recommendation. (Ref:
*XML 1.0 Attribute Types)
- CDATA
- Arbitrary character data
- Enumeration
- If present, the attribute must take one of the listed values
- ID
- An element identifier which must be unique to the document. It may consist of any combination of letters, digits, and the four punctuation characters _:.- but must begin with a letter, a colon or an underscore
- IDREF
- A reference to an element identifier of type ID
- IDREFS
- A space-separated list of one or more IDREF values
- NMTOKEN
- A name which may consist of any combination of letters, digits, and the four punctuation characters _:.-
- NMTOKENS
- A space-separated list of one or more NMTOKEN values
These attribute types are specific to XHTML Modularisation 1.1 but each must be declared in the DTD as one
of the native Attribute Types Defined by XML 1.0.
According to the DTD, all the following types are declared as
CDATA, apart from
Boolean and Shape (which are declared as Enumeration) and
LinkTypes (which is declared as NMTOKENS). [For more information see
*W3C - XHTML Modularisation 1.1 - Attribute Types,
but note that the Boolean type is not explicitly mentioned there - it is merely a helpful term, in common
use, which is applied to such enumerated types.]
- Boolean
- A Boolean attribute. This is a type assigned to certain optional "on/off" attributes - if present, the attribute should be given its own name as its value, e.g. checked="checked"
- Character
- A single ISO 10646 Character, e.g. "x"
- Charset
- An RFC2045 Character Encoding, e.g. "utf-8", "US-ASCII" or "ISO-8859-1"
- Charsets
- A space-separated list of RFC2045 Character Encodings, e.g. "utf-8 US-ASCII ISO-8859-1"
- ContentType
- An RFC2045 MIME Media Type, e.g. "application/xhtml+xml", "application/xml", "text/xml", "text/html", "text/plain", "text/css", "text/javascript", "application/javascript", "application/octet-stream", "image/jpeg", "audio/mpeg", "multipart/form-data"
- ContentTypes
- A comma-separated list of RFC2045 MIME Media Types
- Coords
- Numerical coordinates specifying the dimensions and position of a shape (all x and y coordinates are measured from the top left corner of the image)
- Datetime
- Date and Time in the W3C profile of the ISO 8601 date format (YYYY-MM-DDThh:mm:ssTZD), e.g. "2006-01-31T13:52:10-05:00", "2006-05-28T21:01:26Z"
- FPI
- An SGML Formal Public Identifier
- FrameTarget
- A value indicating the window or frame in which to load a hyperlink (e.g. "_blank", "_top")
- LanguageCode
- An RFC3066 language code, e.g. "en" (Generic English), "en-GB" (British English), "en-US" (US English), "fr" (French), "he" (Hebrew)
- Length
- Length specified as a percentage or in pixels, e.g. "20%" or "10"
- LinkTypes
- A space-separated list of one or more link types
- MediaDesc
- A comma-separated list of one or more recognised media descriptors, e.g. "all", "screen", "screen, print"
- MultiLength
- This is a length specified in pixels (e.g. "400"), as a percentage of the available horizontal space (e.g. "20%") or as a relative unit "d*" where d is an integer (e.g. "1*", "3*")
- Number
- One or more digits, making up a single positive number (or zero) e.g. "34", "2"
- Pixels
- An integer specifying length in pixels, e.g. "3"
- Script
- A script expression to be passed to the appropriate scripting engine
- Shape
- A shape within an image, which can be "rect", "circle", "poly" or "default" (where "rect" denotes a rectangle and "poly" denotes a polygon)
- Text
- Arbitrary user-visible text
- URI
- A Uniform Resource Identifier
- URIs
- A space-separated list of Uniform Resource Identifiers
- No single element may be given two attributes with the same name.
(ref: well-formedness constraint of *XML 1.0 Start-Tags, End-Tags, and Empty-Element Tags)
- Attributes may be specified in any order in the start-tag of an element
- Each attribute must have been declared, with a specific Attribute Type, in the DTD for the element in question and must obey the rules for that Type.
- Attribute names are case-sensitive (they are exclusively lower-case in XHTML 1.1).
- All #REQUIRED attributes must be present.
All #FIXED attributes, if present, must be given the declared default value.
(see *XML 1.0 Attribute Defaults)
- Attribute values may be delimited by either a pair of double quote (") characters or a pair of single quote (')
characters. Both are equally valid for XML 1.0 documents
(see *XML 1.0 AttValue definition) but
double quote delimiters do tend to be more common (and are used throughout this reference).
- Within attribute values:
- Every less-than character (<) within an attribute value must
be escaped as
< (or <).
- Every ampersand character (&) which does not denote the start of an entity or character reference
(e.g.
<) must be escaped as & (or &).
- Every double quote character (") must be escaped as
"
(or ") if using double quotes to delimit the attribute value
- Every single quote character (') must be escaped as
'
(or &#apos; - but see Character Entities Predefined by XML 1.0) if using single quotes to delimit the attribute value
- For information on white-space handling in attributes, see
*XML 1.0 Attribute-Value Normalisation.
- If compatibility is between XML-based and HTML-based user agents, attribute values should not contain line breaks
or multiple consecutive whitespace. Ref: the W3C Note (work in progress)
*XHTML Media Types - Compatibility Guidelines - Item A.5