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

Re: Attributes with no value

From: <pdf@bizfon.com>
Date: Thu, 9 Nov 2000 13:40:40 -0500
To: www-html@w3.org
Message-ID: <85256992.00669A49.00@Enterprise>


Thanks for you detailed response!  It's all very clear now.  I guess my only
options are
1.  Hope for a bug fix from Microsoft (not likely)
2.  Accept the bug and allow invalid code to be generated
3.  Manually search each document I produce with Interdev and replace the
invalid code by hand
4.  Find a better HTML editor (got any suggestions?)

Thanks again!
-Pete





Jan Roland Eriksson <jrexon@newsguy.com> on 11/09/2000 01:27:41 PM

Please respond to www-html@w3.org

To:   Peter Foti@pctco.com
cc:   www-html@w3.org

Subject:  Re: Attributes with no value



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
inspection.

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
misunderstanding.

>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:38:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:15:44 GMT