[uf-discuss] hCard uid

Toby A Inkster mail at tobyinkster.co.uk
Fri Apr 25 00:39:59 PDT 2008


Stephen Paul Weber wrote:

> and give me a value of Weber, Stephen Paul for uid - the intended
> value was definitely http://singpolyma.net/

Your code is certainly right. If a parser isn't looking at the href  
attribute (and it should!) for the UID, then the best you can do is  
force it using something like the ABBR pattern:

<a class="url" rel="me" href="http://singpolyma.net/"><span
class="family-name">Weber</span>,
<span class="given-name">Stephen</span>
<span class="additional-name">Paul</span>
</a>
<abbr title="http://singpolyma.net/" class="uid"
style="display:none"></abbr>

For the record, the behaviour Cognition <http://buzzword.org.uk/ 
cognition/> uses for parsing UID is this:

1. If the UID has an ID attribute, uses the URI for the fragment;
2. Otherwise if the UID is an <a> or <area> element, uses the href;
3. Otherwise if the UID is an <img> element, uses the src;
4. Otherwise if the UID is an <object> element, uses the data attribute;
5. Otherwise uses the UID node contents, respecting the ABBR design  
pattern, value excerpting, include pattern, etc.
6. If there is no UID node at all, then it uses the id attribute of  
the vcard root element (if any).

So it will correctly parse both the example I provided above, and  
your original example.

-- 
Toby A Inkster
<mailto:mail at tobyinkster.co.uk>
<http://tobyinkster.co.uk>





More information about the microformats-discuss mailing list