[thelist] Which is more Semantically Correct(tm) ??

Maximillian Schwanekamp anaxamaxan at neptunewebworks.com
Thu Jun 3 12:38:48 CDT 2004


-------------------------
I said:
What is most correct
for presenting key-value attributes for one or more more-or-less discrete
items?

Manuel said:
semantic markup is much a matter of personal (hopefully informed ;)
decision, but i'd say that
<h2>Item A</h2>
 <ul>
<li>
 <dl>
   <dt>Attrib1</dt>
   <dd>Value</dd>
 </dl>
</li>........

Tim said:
The information you have is perfect for displaying in rows and
columns.  I suggest sticking with the tabular presentation in this
instance.

Sarah said:
Maybe I'm misunderstanding the point of the <dl> tag - it's supposed to
be a list, right? So wouldn't this be more appropriate?
<dl>
   <dt>Item A</dt>
   <dd>
     <dl>
       <dt>Attrib 1</dt>
       <dd>Value</dd>

       <dt>Attrib 2</dt>
       <dd>Value</dd>

       <dt>Attrib 3</dt>
       <dd>Value</dd>
     </dl>
   </dd>........
------------------------

I posted this question to the Webdesign-L list as well, and did get what I
felt was a persuasive answer from Alberto Perez.  A snippet:
>In that table there are two groups of data, positions and names, and that
>data has relationships both in horizontal and in vertical directions: As a
>position-name pairs and as lists of position and names. But in your case I
>can't think of a title for the two columns apart from "keys" and "values"
>of something similar, since the data doesn't have a clear "vertical"
>relationship.

The operative principal being that in tabular data, there should be clear
relationships both in the rows and in the columns.  In this case, I had sets
of keys and values which were effectively attributes of a single item, i.e.
a horizontal relationship but not a vertical one (beyond the most tenuous).
By this reasoning using a table would be the wrong choice.  UL/OL do not
have the key-value relationship either (without nesting anyway), so DL it
is.  Further, the DL spec allows multiple DTs and/or multiple DDs, allowing
for key variants or multiple values.  A very handy element!  The W3 spec[1]
makes the suggestion of broader use than just strict term-definition use:
"Another application of DL, for example, is for marking up dialogues, with
each DT naming a speaker, and each DD containing his or her words."  To me
this suggests something close to key-value.

In the end, I went with the structure that Sarah suggested.  I think I
already posted a URI yesterday but here it is again[2] since some of my
posts seem be failing to reach the list.

[1] http://www.w3.org/TR/html401/struct/lists.html#edef-DL
[2] http://neptunewebworks.com/evolt/cards2/

Maximillian Von Schwanekamp
Dynamic Websites and E-Commerce
www.NeptuneWebworks.com
voice: 541-302-1438
fax: 208-730-6504





More information about the thelist mailing list