W3C home > Mailing lists > Public > www-style@w3.org > March 2002

Re: RE: OL starting with zero

From: Jonny Axelsson <jax@opera.no>
Date: Tue, 26 Mar 2002 19:34:16 +0100
To: www-style@w3.org
Cc: w3c-html-wg@w3.org
Message-Id: <VSXSPMICXSKH3VLGKFMGAQSMD02WS.3ca0bf28@falcon>
26.03.02 04:12:05, "Lindsay Evans" <lindsay@redsquare.com.au> wrote:

>> At 2:44 AM +0100 3/26/02, Christoph P?per wrote:
>> >  > Might I suggest an extra list-style-type, say "code"
>> >>  which is equivalent to "decimal" but starts with zero?
>> >
>> >You mean decimal-leading-zero?
>>
>> No, I think he means one where the first element is numbered
>> zero instead of one. E.g.:
>
>isn't this what counter-reset[1] is for?

Counters can be used for numbered lists, and they can be any integer, 
positive, negative or zero (and they are so in Opera, the only 
implementation of CSS counters I know of). But as others have said there 
isn't really a close mapping of counters and ordered list items.


There is a way to have a larger audience than Opera-only, and that is using 
the START and VALUE attributes in UL and LI respectively. I.e. 

<ol start="0">
  <li>I should be zero</li>
</ol>


They are admittedly deprecated in HTML 4.0 and upwards (ending up in the 
optional Legacy module for XHTML Modularization), but still supported. 
Furthermore signs are that these two attributes will be de-deprecated in 
XHTML 2.0 (or at least the VALUE attribute of LI, as strictly speaking START 
is redundant).

The attribute value data types are defined differently in (X)HTML and in 
CSS. Where CSS uses "integer", HTML uses "number". And number is SGML-ese 
for a sequence of digits [0-9]. This means you can have zero, but you can't 
have negative values, nor can you have rational numbers ("1.5").

I made some tests (attached) to see the current browser support. The value 
"0" is accepted by IE and Opera, but a little surprisingly not by Netscape 
(4 or 6). There may be a workaround, but I couldn't find any.


In a sense it isn't too surprising, as (in CSS-speak) a value of "0" only 
makes sense for list-style-type: decimal | decimal-leading-zero | disc | 
circle | square | none. How do you represent "0" in upper-roman or lower-
latin? (Note to the authors of CSS3: Lists [1], "underflow" should probably 
be mentioned just as "overflow" when it comes to alphabethical numbering 
schemes.)

[1] <http://www.w3.org/TR/css3-lists/>


Jonny Axelsson
Documentation,
Opera software

rt/mixed;
	boundary="----------lczpFoLzy6Ii0MMhWKnOOi"

------------lczpFoLzy6Ii0MMhWKnOOi
Content-Type: text/plain; charset="iso-8859-1"

26.03.02 04:12:05, "Lindsay Evans" <lindsay@redsquare.com.au> wrote:

>> At 2:44 AM +0100 3/26/02, Christoph P?per wrote:
>> >  > Might I suggest an extra list-style-type, say "code"
>> >>  which is equivalent to "decimal" but starts with zero?
>> >
>> >You mean decimal-leading-zero?
>>
>> No, I think he means one where the first element is numbered
>> zero instead of one. E.g.:
>
>isn't this what counter-reset[1] is for?

Counters can be used for numbered lists, and they can be any integer, 
positive, negative or zero (and they are so in Opera, the only 
implementation of CSS counters I know of). But as others have said there 
isn't really a close mapping of counters and ordered list items.


There is a way to have a larger audience than Opera-only, and that is using 
the START and VALUE attributes in UL and LI respectively. I.e. 

<ol start="0">
  <li>I should be zero</li>
</ol>


They are admittedly deprecated in HTML 4.0 and upwards (ending up in the 
optional Legacy module for XHTML Modularization), but still supported. 
Furthermore signs are that these two attributes will be de-deprecated in 
XHTML 2.0 (or at least the VALUE attribute of LI, as strictly speaking START 
is redundant).

The attribute value data types are defined differently in (X)HTML and in 
CSS. Where CSS uses "integer", HTML uses "number". And number is SGML-ese 
for a sequence of digits [0-9]. This means you can have zero, but you can't 
have negative values, nor can you have rational numbers ("1.5").

I made some tests (attached) to see the current browser support. The value 
"0" is accepted by IE and Opera, but a little surprisingly not by Netscape 
(4 or 6). There may be a workaround, but I couldn't find any.


In a sense it isn't too surprising, as (in CSS-speak) a value of "0" only 
makes sense for list-style-type: decimal | decimal-leading-zero | disc | 
circle | square | none. How do you represent "0" in upper-roman or lower-
latin? (Note to the authors of CSS3: Lists [1], "underflow" should probably 
be mentioned just as "overflow" when it comes to alphabethical numbering 
schemes.)

[1] <http://www.w3.org/TR/css3-lists/>


Jonny Axelsson
Documentation,
Opera software

------------lczpFoLzy6Ii0MMhWKnOOi
Content-Disposition: attachment;
	filename="ol-start-value.html"
Content-Type: text/html;
	name="ol-start-value.html"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">

<title>Testing Ordered list start and value attributes</title>

<h1>Ordered list HTML autonumbering</h1>

<h2>The start attribute</h2>

<h3>Ordered list, starting with -1</h3>
<ol start="-1">
  <li>One</li>
  <li>Two</li>
  <li>Three</li>
</ol>
<p>Will begin with "-1" if negative integers are allowed (wrong), "1" otherwise (correct). </p>

<h3>Ordered list, starting with 0</h3>
<ol start="0">
  <li>Zero</li>
  <li>One</li>
  <li>Two</li>
</ol>
<p>Will begin with "0" if zero is allowed (correct), "1" otherwise (wrong).</p>

<h3>Ordered list, starting with 1</h3>
<ol start="1">
  <li>One</li>
  <li>Two</li>
  <li>Three</li>
</ol>

<h3>Ordered list, starting with 2</h3>
<ol start="2">
  <li>Two</li>
  <li>Three</li>
  <li>Four</li>
</ol>

<h3>SGML-test: Ordered list, starting with "002"</h3>
<ol start="002">
  <li>Two</li>
  <li>Three</li>
  <li>Four</li>
</ol>

<h3>Ordered list, starting with 2.5</h3>
<ol start="2.5">
  <li>One</li>
  <li>Two</li>
  <li>Three</li>
</ol>

<p>Expected result is that the illegal value is ignored (i.e. 1-2-3). It could be truncated (i.e. 2,3,4) or using a floating point real (2.5, 3.5, 4.5). Both would be an error.</p>

<h3>Ordered list, starting with C</h3>
<ol start="C">
  <li>One</li>
  <li>Two</li>
  <li>Three</li>
</ol>

<p>Expected result is that the illegal value is ignored (i.e. 1,2,3). It could be mapped to "equivalent" integer (i.e. 3,4,5) or have its list style set to alpha (C,D,E). Both would be an error.</p>

<h2>The value attribute</h2>

<h3>Setting value to -1</h3>
<ol>
  <li>One</li>
  <li value="-1">Two (value="-1")</li>
  <li>Three</li>
</ol>
<p>Will show "1,-1,0" if all integers are allowed (wrong), "1,2,3" otherwise (correct).</p>

<h3>Setting value to 0</h3>
<ol>
  <li>One</li>
  <li value="0">Zero (value="0")</li>
  <li>One</li>
</ol>
<p>Will show "1,0,1" if zero is allowed (correct), "1,2,3" otherwise (wrong).</p>

<h3>Setting value to 1</h3>
<ol>
  <li>One</li>
  <li value="1">One (value="1")</li>
  <li>Two</li>
</ol>

<h3>Setting value to 2</h3>
<ol>
  <li>One</li>
  <li>Two</li>
  <li value="2">Two (value="2")</li>
</ol>

<h3>SGML-test: Setting value to "002"</h3>
<ol start="002">
  <li value="002">Two (value="002")</li>
  <li>Three</li>
  <li>Four</li>
</ol>

<h3>Setting value to 2.5</h3>
<ol>
  <li value="2.5">One (value="2.5")</li>
  <li>Two</li>
  <li>Three</li>
</ol>

<p>Expected result is that the illegal value is ignored (i.e. 1-2-3). It could be truncated (i.e. 2,3,4) or using a floating point real (2.5, 3.5, 4.5). Both would be an error.</p>

<h3>Setting value to C</h3>
<ol>
  <li>One</li>
  <li value="C">Two (value="C")</li>
  <li>Three</li>
</ol>

<p>Expected result is that the illegal value is ignored (i.e. 1-2-3). It can mapped to "equivalent" integer (i.e. 1,3,4) or have its list style set to alpha (A,C,E). Both would be an error.</p>
o (value="-1")</li>
  <li>Three</li>
</ol>
<p>Will show "1,-1,0" if all integers are allowed (wrong), "1,2,3" otherwise (correct).</p>

<h3>Setting value to 0</h3>
<ol>
  <li>One</li>
  <li value="0">Zero (value="0")</li>
  <li>One</li>
</ol>
<p>Will show "1,0,1" if zero is allowed (correct), "1,2,3" otherwise (wrong).</p>

<h3>Setting value to 1</h3>
<ol>
  <li>One</li>
  <li value="1">One (value="1")</li>
  <li>Two</li>
</ol>

<h3>Setting value to 2</h3>
<ol>
  <li>One</li>
  <li>Two</li>
  <li value="2">Two (value="2")</li>
</ol>

<h3>SGML-test: Setting value to "002"</h3>
<ol start="002">
  <li value="002">Two (value="002")</li>
  <li>Three</li>
  <li>Four</li>
</ol>

<h3>Setting value to 2.5</h3>
<ol>
  <li value="2.5">One (value="2.5")</li>
  <li>Two</li>
  <li>Three</li>
</ol>

<p>Expected result is that the illegal value is ignored (i.e. 1-2-3). It could be truncated (i.e. 2,3,4) or using a floating point real (2.5, 3.5, 4.5). Both would be an error.</p>

<h3>Setting value to C</h3>
<ol>
  <li>One</li>
  <li value="C">Two (value="C")</li>
  <li>Three</li>
</ol>

<p>Expected result is that the illegal value is ignored (i.e. 1-2-3). It can mapped to "equivalent" integer (i.e. 1,3,4) or have its list style set to alpha (A,C,E). Both would be an error.</p>


Received on Tuesday, 26 March 2002 13:29:16 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:13 GMT