Re: OLStyle should be enumeration?

On Fri, 27 Apr 2007, Jim Jewett wrote:

> On 4/26/07, Chris <chrishe@hmgcc.gsi.gov.uk> wrote:
>
>> In all the XHTML 1.0 schemas (http://www.w3.org/TR/xhtml1-schema/)
>> OLStyle type is defined as a xs:string.  In the documentation, it is
>> clear that it can only take 5 values.
>
>> Why isn't it defined as an enumeration? Is there a reason or is it an
>> oversight?
>
> See http://www.w3.org/TR/REC-CSS2/generate.html#lists

Why would that matter? The internal structure of style sheet languages 
such as CSS has no impact on (X)HTML syntax.

> CSS2 allows several other values.

That's irrelevant. It would be relevant only if CSS and (X)HTML were 
developed in parallel, so that added property values in CSS would be 
reflected in (X)HTML development as added values for the corresponding 
attribute. There is no sign of anything like that. The type attribute in 
<ol> has been deprecated in XHTML 1.0 and omitted from XHTML 1.1, so we 
can't really expect it to be _enhanced_.

> Given the fallback semantics ("A user agent that does not recognize a
> numbering system should use 'decimal'."), it doesn't make sense to
> pre-emptively rule out ordering based on additional alphabets and/or
> numbers.

That semantics only applies to CSS.

My guess on the matter (why not defined as an enumeration) is that it's a 
holdover from DTDs where an enumeration may only contain names (and names 
cannot start with a digit). People just didn't think about the possibility 
of using an enumeration in a schema.

Prohibiting additional alphabets or numbers is something that a schema 
_should_ do. Rather than an argument against using an enumeration, it is a 
strong argument in favor of it. A schema should define the syntax of one 
specific version of a language. If you wish to extend the language later, 
you naturally update the syntax definition, the schema, as well.

Using xs:string means basically that anything goes. This means that 
practically no errors, including simple typos, in the attribute value can 
be caught in formal syntax checking. For example, if you accidentally 
write type="A" so that the letter is the capital Cyrillic letter A or the 
capital Greek letter A (which look exactly the same as Latin A in 
virtually all fonts), a syntax checker could not detect the error, whereas 
browsers would treat the value as unrecognized and ignore the attribute 
(or, in principle, apply some other error processing).

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

Received on Saturday, 28 April 2007 06:37:41 UTC