W3C home > Mailing lists > Public > www-validator@w3.org > March 2005

Re: Validation Question

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Sat, 12 Mar 2005 07:29:04 +0200 (EET)
To: Paul Trivilino <ptrivilino@trivilinodesign.com>
Cc: www-validator@w3.org
Message-ID: <Pine.GSO.4.58.0503120706320.22549@korppi.cs.tut.fi>

On Fri, 11 Mar 2005, Paul Trivilino wrote:

> I used your validation service to check the HTML in a Website I am
> designing. One of the pages contains an image map which caused the page to
> come up with an error. Here is the error:
>
>    1.      Line 71, column 137: required attribute "id" not specified

As usual, you should have included the URL of the page that causes the
problem. That would have made it clear which DOCTYPE you are using, among
other things.

In this case, it is rather obvious, though, that you are using an XHTML
DOCTYPE, for some odd reason. Then you have a problem. The XHTML DOCTYPEs
make the "id" attribute required. The XHTML 1.0 specification
contains a silent change to that effect:

<!ATTLIST map
  %i18n;
  %events;
  id          ID             #REQUIRED
  class       CDATA          #IMPLIED
  style       %StyleSheet;   #IMPLIED
  title       %Text;         #IMPLIED
  name        NMTOKEN        #IMPLIED
  >

In practice, you can add an "id" attribute with the same value as your
"name" attribute, if it satisfies the rules of ID syntax, as it does in
your case. So just use
<map name="map00be11ffd4" id="map00be11ffd4">
(That "id" attribute is of no practical use. It's there just to
satisfy XHTML syntax rules, and to please some hypothetical
future browsers that recognize "id" but not "name".)

Beware that the "Differences with HTML 4" section in the XHTML 1.0
specification ( http://www.w3.org/TR/html/#diffs ) is incomplete
and partly incorrect. In particular, clause 4.10 (The elements with 'id'
and 'name' attributes) tells that "MUST use the id attribute when
defining fragment identifiers on the elements" a, applet, form, frame,
iframe, img, and map, but it does not say that in the <map> element
(but not in the other elements mentioned), the "id" attribute is formally
required now.

If you use XHTML 1.1 for some odd reason, you have big problem:
XHTML 1.1 disallows the "name" attribute in a <map> element - and the
"name" attribute is needed to make the map work on current browsers. This
change is even mentioned at
http://www.w3.org/TR/xhtml11/changes.html#a_changes

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
Received on Saturday, 12 March 2005 05:29:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:18 GMT