views:

19

answers:

2

I'm revamping my work's Employee Directory, adding hCard data to each employee's listing.

An issue I haven't been able to figure out is how to avoid duplicating information, such as organization-name and organization-unit.

Here's a trimmed-down example of my code:

<div id="hcard-business" class="vcard">
  <div class="adr">
    <div class="org fn"><a class="url" href="http://www.business.com/"&gt;Business&lt;/a&gt;&lt;/div&gt;
    <div class="street-address">123 Business Street</div>
    <div>
      <span class="locality">City</span>, 
      <abbr class="region" title="State">ST</abbr>,
      <span class="postal-code">99999</span>,
      <span class="country-name">USA</span></div>
    </div>
  </div>
</div>

<table class="contact">
  <thead>
    <tr><th colspan="4">Marketing Department</th></tr>
    <tr class="head"><th>NAME</th><th>TITLE</th><th>PHONE</th><th>EMAIL</th></tr>
  </thead>
  <tbody>
    <tr id="hcard-employee1" class="vcard odd">
      <td class="fn">Employee Name</td>
      <td class="title">Director</td>
      <td class="tel">907-335-1243</td>
      <td>
        <a class="email" href="mailto:[email protected]">[email protected]</a> 
        <span class="org fn hidden">
          <span class="organization-name">Business Name</span>, 
          <span class="organization-unit">Marketing</span>
        </span>
      </td>
    </tr>
    <tr id="hcard-employee2" class="vcard even">
      <td class="fn">Employee Name</td>
      <td class="title">Assistant</td>
      <td class="tel">907-335-1243</td>
      <td>
        <a class="email" href="mailto:[email protected]">[email protected]</a> 
        <span class="org fn hidden">
          <span class="organization-name">Business Name</span>, 
          <span class="organization-unit">Marketing</span>
        </span>
      </td>
    </tr>
  </tbody>
</table>

What I'm attempting to do is trim out the hidden span from the last <td>, grabbing organization-name from the business' hCard and organization-unit from the <thead>.

I've pretty much scoured microformats.org looking for an example of what I'm attempting, but no luck. I've even peeked at several of their "microformats in the wild" list, but the few sites I found there with multiple employee lists were using the same hidden method with duplicate information that I've used in my example.

Is what I'm attempting to do even possible?

+1  A: 

I think you should separate things. One card for your company, and one card for each employee.

Repeating organization-name, organization-unit on each employee card is not a problem at all.

Dave
+2  A: 

From a semantic standpoint, it is incorrect to try to avoid duplication. Being as verbose as possible (even in the name of duplicating code) is the most effective way to be as explicit as possible. Your best option is to hide it as you're doing. There is no way--according to the hCard spec--to reference information elsewhere in the document.

Hope this clears things up.

mattbasta
Thanks, this makes perfect sense to me now.
jnpcl