RE: Attributes with no value [fairly off topic]

Another very strange thing I recently encountered with InterDev...

We were all working on Homesite and one programmer insisted on Interdev.  

It did several really strange things every time he would open up a document.
(even if he made no changes)

It kept messing up our style...goofing up indention spacing etc.
It kept changing valign="middle" to valign="center"
and vice versa  align="center" kept changing to align="middle"

very strange, I really dislike this editor for basic HTML tasks now...

Perhaps someone could comment on how running HTML-Tidy on this poorly
generated code could be used to fix these problems.  (now we are back on
topic - I hope)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
Richard Taylor                       
marchFIRST                             
415-369-6926                          
<http://www.marchFIRST.com> 
Richard.t.taylor@marchFIRST.com 



-----Original Message-----
From: pdf@bizfon.com [mailto:pdf@bizfon.com]
Sent: Thursday, November 09, 2000 10:41 AM
To: www-html@w3.org
Subject: Re: Attributes with no value




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 14:06:23 UTC