W3C home > Mailing lists > Public > www-html@w3.org > November 2000

Re: Attributes with no value

From: Jan Roland Eriksson <jrexon@newsguy.com>
Date: Thu, 09 Nov 2000 19:27:41 +0100
To: pdf@bizfon.com
Cc: www-html@w3.org
Message-ID: <hdnl0tc1tkej9t5f91m4hcbe7m6mpmccb1@4ax.com>
On Thu, 9 Nov 2000 11:28:33 -0500, pdf@bizfon.com wrote:


>I have noticed that the Microsoft Visual Interdev 6.0 editor will occasionally
>replace my code with it's own.  For example, it tends to remove the value of
>attributes with empty values.

><img alt="" src="someimage.gif">
>would be replaced with:
><img alt src="someimage.gif">

That looks like the result of a definite bug in MSVI6.

>...Apparently the generated code is not valid?!
>Is that right?

Yes it's syntactically invalid HTML as based on available
recommendations from W3C.

>When I try to validate a document...I get:

>Error: "ALT" is not a member of a group specified for any attribute
>Followed by:
>Error: required attribute "ALT" not specified

>What does it mean about "not a member of a group specified for any attribute"?

SGML markup minimization is enabled for HTML. This means in this case
that it might be valid minimized markup to replace e.g...

  some-attribute=value  ..with only..  value

...as the specification of an attribute value for some element.

Now for this type of markup minimization to be a syntactically valid
variant, a validating parser must be able to find a defined _group_ of
allowed values for a specific attribute (in the external subset, i.e.
the HTML DTD, in this case). If it finds it, it can then go on to infer
the normalized markup from there.

What happens in your case is that the validator is looking at that plain
word 'alt' _not_as_an_attribute_without_a_value_ but instead it takes it
as _the_value_of_some_attribute_ that it has to try to match to some
attribute name in the ATTLIST declaration for the element under

For your example that inference is not possible to do since the IMG
element does not have a group of defined values for its ALT attribute.

We could play with the thought that the IMG element has a list of
allowed values for its ALT attribute, where the string "alt" is one of
them. Then the validator would have done this (internally)

         <img alt src="someimage.gif">
look at this--^^^--and infer this--vvv--from it...
                          <img alt=alt src="someimage.gif">
...and normalize it into-------^^^^^^^

>It seems to me that instead of being invalid, this should be considered as an
>attribute with no value (the same as alt="").

SGML markup minimization needs to be <em/studied/ and you are by no
means the first one to fall into this particular SGML trap :)

Lots of "rubbish" has been written over time about so called "boolean
attributes" which basically just displays a variant of the same basic

>Is there some fundamental principle of HTML that I'm missing?

It's something about SGML markup minimization that you have "missed" and
I hope that my description above was of some help to get you back on
track. If you need more info, just ask again.

>If not, then is it possible to modify the validator...

I think we are all at best to leave the validators to do their things as
they do, they are in fact correct on this :)

Jan Roland Eriksson <rex@css.nu> .. <URL:http://css.nu/>
Received on Thursday, 9 November 2000 13:28:25 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:05:55 UTC