Re: Use of headers and summary attributes (was : <font> (was Support Existing Content))

2007/5/4, Denis Boudreau:
>
> <table summary="">
> <caption>Travelling expenses report</caption>
> <tr>
>    <th id="l1c1">Destination</th>
>    <th id="l1c2">Traveling dates</th>
>    <th id="l1c3">Meal</th>
>    <th id="l1c4">Hotel</th>
>    <th id="l1c5">Transport</th>
>    <th id="l1c6">Total</th>
> </tr>
> <tr>
>    <th id="l2c1" headers="l1c1" rowspan="3">Atlanta</th>
>    <th id="l2c2" headers="l1c2 l2c1">August 25th</th>
>    <td headers="l1c3 l2c1 l2c2">37</td>
>    <td headers="l1c4 l2c1 l2c2">112</td>
>    <td headers="l1c5 l2c1 l2c2">45</td>
>    <td headers="l1c6 l2c1 l2c2">&nbsp;</td>
> </tr>
> <tr>
>    <th id="l3c2" headers="l1c2 l2c1">August 26th</th>
>    <td headers="l1c3 l2c1 l3c2">27</td>
>    <td headers="l1c4 l2c1 l3c2">112</td>
>    <td headers="l1c5 l2c1 l3c2">45</td>
>    <td headers="l1c6 l2c1 l3c2">&nbsp;</td>
> </tr>
> <tr>
>    <th id="l4c2" headers="l1c2 l2c1">Sub-total</th>
>    <td headers="l1c3 l2c1 l4c2">64</td>
>    <td headers="l1c4 l2c1 l4c2">224</td>
>    <td headers="l1c5 l2c1 l4c2">90</td>
>    <td headers="l1c6 l2c1 l4c2">378</td>
> </tr>
> <tr>
>    <th id="l5c1" headers="l1c1" rowspan="3">Boston</th>
>    <th id="l5c2" headers="l1c2 l5c1">August 27th</th>
>    <td headers="l1c3 l5c1 l5c2">96</td>
>    <td headers="l1c4 l5c1 l5c2">109</td>
>    <td headers="l1c5 l5c1 l5c2">36</td>
>    <td headers="l1c6 l5c1 l5c2">&nbsp;</td>
> </tr>
> <tr>
>    <th id="l6c2" headers="l1c2 l5c1">August 28th</th>
>    <td headers="l1c3 l5c1 l6c2">35</td>
>    <td headers="l1c4 l5c1 l6c2">109</td>
>    <td headers="l1c5 l5c1 l6c2">36</td>
>    <td headers="l1c6 l5c1 l6c2">&nbsp;</td>
> </tr>
> <tr>
>    <th id="l7c2" headers="l1c2 l5c1">Sub-total</th>
>    <td headers="l1c3 l5c1 l7c2">131</td>
>    <td headers="l1c4 l5c1 l7c2">218</td>
>    <td headers="l1c5 l5c1 l7c2">72</td>
>    <td headers="l1c6 l5c1 l7c2">421</td>
> </tr>
> <tr>
>    <th id="l8c1">Compilation</th>
>    <th id="l8c2">Grand total</th>
>    <td headers="l1c3 l8c1 l8c2">195</td>
>    <td headers="l1c4 l8c1 l8c2">442</td>
>    <td headers="l1c5 l8c1 l8c2">162</td>
>    <td headers="l1c6 l8c1 l8c2">799</td>
> </tr>
> </table>

Let's try to rewrite this table without headers and id and let the UA
associate data cells with header cells:

<table summary="">
<caption>Travelling expenses report</caption>
<tr>
   <th>Destination</th>
   <th>Traveling dates</th>
   <th>Meal</th>
   <th>Hotel</th>
   <th>Transport</th>
   <th>Total</th>
</tr>
<tr>
  <th rowspan="3">Atlanta</th>
  <th scope="row">August 25th</th>
  <td>37</td>
  <td>112</td>
  <td>45</td>
  <td>&nbsp;</td>
</tr>
<tr>
  <th scope="row">August 26th</th>
  <td>27</td>
  <td>112</td>
  <td>45</td>
  <td>&nbsp;</td>
</tr>
<tr>
  <th scope="row">Sub-total</th>
  <td>64</td>
  <td>224</td>
  <td>90</td>
  <td>378</td>
</tr>
<tr>
  <th rowspan="3">Boston</th>
  <th scope="row">August 27th</th>
  <td>96</td>
  <td>109</td>
  <td>36</td>
  <td>&nbsp;</td>
</tr>
<tr>
  <th scope="row">August 28th</th>
  <td>35</td>
  <td>109</td>
  <td>36</td>
  <td>&nbsp;</td>
</tr>
<tr>
  <th scope="row">Sub-total</th>
  <td>131</td>
  <td>218</td>
  <td>72</td>
  <td>421</td>
</tr>
<tr>
  <th>Compilation</th>
  <th scope="row">Grand total</th>
  <td>195</td>
  <td>442</td>
  <td>162</td>
  <td>799</td>
</tr>
</table>

If I've correctly read and understood [1], this would lead to exactly
the same result (re associating header cells and data cells).

[1] http://www.whatwg.org/specs/web-apps/current-work/#header-and-data-cell-semantics

-- 
Thomas Broyer

Received on Friday, 4 May 2007 15:31:20 UTC