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

Re: ID 'FOO' already defined

From: Liam Quinn <liam@htmlhelp.com>
Date: Thu, 20 Mar 2003 01:28:57 -0500 (EST)
To: Dan Smith <dan.smith@chrometoaster.com>
cc: www-validator@w3.org
Message-ID: <Pine.LNX.4.44.0303200125000.1922-100000@localhost.localdomain>

On Thu, 20 Mar 2003, Dan Smith wrote:

> My page failed to validate because of the following error:
> 
> “ID ‘FOO’ already defined” 
[...] 
> The repeated IDs are used to match column headers in the top row of my
> table with id'd rows further down, ie:
> 
>   <table summary="An accessible table.">
>     <tr> 
>       <td headers="h1">Column 1 heading</td>
>       <td headers="h2">Column 2 heading</td>
>       <td headers="h3">Column 3 heading</td>
>     </tr>
>     <tr> 
>       <td id="h1">Column 1 Content</td>
>       <td id="h2">Column 2 Content</td>
>       <td id="h3">Column 3 Content</td>
>     </tr>
>     <tr> 
>       <td id="h1">Column 1 Content</td>
>       <td id="h2">Column 2 Content</td>
>       <td id="h3">Column 3 Content</td>
>     </tr>
> </table>

You have that backwards.  The header cells should have "id" attributes
while the non-header cells have "headers" attributes:

  <table summary="An accessible table.">
    <tr> 
      <td id="h1">Column 1 heading</td>
      <td id="h2">Column 2 heading</td>
      <td id="h3">Column 3 heading</td>
    </tr>
    <tr> 
      <td headers="h1">Column 1 Content</td>
      <td headers="h2">Column 2 Content</td>
      <td headers="h3">Column 3 Content</td>
    </tr>
    <tr> 
      <td headers="h1">Column 1 Content</td>
      <td headers="h2">Column 2 Content</td>
      <td headers="h3">Column 3 Content</td>
    </tr>
  </table>

Using the "scope" attribute instead of "id" and "headers" would be simpler 
in this case though:

  <table summary="An accessible table.">
    <tr> 
      <td scope="col">Column 1 heading</td>
      <td scope="col">Column 2 heading</td>
      <td scope="col">Column 3 heading</td>
    </tr>
    <tr> 
      <td>Column 1 Content</td>
      <td>Column 2 Content</td>
      <td>Column 3 Content</td>
    </tr>
    <tr> 
      <td>Column 1 Content</td>
      <td>Column 2 Content</td>
      <td>Column 3 Content</td>
    </tr>
  </table>

I would also use "th" instead of "td" for the headings.

-- 
Liam Quinn
Received on Thursday, 20 March 2003 01:41:58 GMT

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