Sp 257

From Htmlpedia
Jump to: navigation, search

OpenSP: an attribute value specification must be an attribute value literal unless SHORTTAG YES is specified

Cause:

An attribute value is not enclosed in quotes.

Example:

Bad<p class=foo>
Bad<img height=92 …>
Good<p class="foo">
Good<img height="92" …>

Solution:

  • Quote all attribute values.

Further information:

(From Attributes section of HTML specification): SGML recommends that all attribute values be delimited using either double quotation marks (ASCII decimal 34) or single quotation marks (ASCII decimal 39). Single quote marks can be included within the attribute value when the value is delimited by double quote marks, and vice versa. Authors may also use numeric character references to represent double quotes (") and single quotes ('). For double quotes authors can also use the character entity reference &quot;.

In certain cases, authors may specify the value of an attribute without any quotation marks. The attribute value may only contain letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45), and periods (ASCII decimal 46).

There are instances where attributes may not contain values; they are self-referential, such as compact, selected, checked, etc., and are contained within tags that are declared SHORTTAG YES, such as <select>, <ul>, <input type="radio" />, etc.. These attributes must be expanded should the document be declared as XHTML to compact="compact", selected="selected", checked="checked", etc..

References: