[uf-discuss] Can singular sub-properties be mixed with parent
Tantek Ç elik
tantek at cs.stanford.edu
Thu Oct 27 16:57:37 PDT 2005
On 10/27/05 3:53 PM, "Scott Reynen" <scott at randomchaos.com> wrote:
> I just added hCard formatting to the contact info on my personal
Make sure to add the page with your hCard to the "Examples in the Wild"
section in the spec:
> and I came across some uncertainty about handling of
> singular sub-properties.
> My two actual cases were, class="org organization-name" and
> class="tel value", both of which appear to be redundant on further
> reading. But is this kind of mixing of sub-properties with parent
> properties in the same class list generally proper syntax for cases
> where only one sub-property is used?
This is a great question Scott, and I think one that many others will have
so I will add it to the FAQ.
The short answer is no. For *lots* of reasons (including disambiguation
from the parent's subproperties), all sub-properties MUST be on elements
*inside* the property.
(many many months ago, maybe a year ago?, Brian Suda and I thought about
this possibility and tried to make it work with X2V etc., but quickly
realized that we would numerous problematic cases, so in this instance, in
order to make the data parsable, we ask just a *a little bit* of the
content, that is, a separate element for a sub-property from the element for
On to your specific examples:
> If, for example, I wanted to
> indicate that I work in the espionage department, but not specify
> which company I work for, would the following be okay?
> <span class="org organization-unit"> Espionage </a>
No, but for several reasons. Both the above reason, and:
If you want to explicitly *not* specify the which company name (which, I
should point out, is NOT the common case, and certainly NOT the 80/20, so
bear with me on the markup), you should add that:
This is essentially the equivalent of the symbol "0" for numbers.
> Or if I only wanted to list my last name?
> <span class="n family-name">Smith</span>
Adding "fn", since that is required as part of hCard/vCard, and following
the pattern in the previous example:
<span class="n fn">
<span class="n family-name">Smith</span>
> And while I'm at it, what if two sub-properties have the same value?
> If one's name were "Rose Rose," could I do the following?
> <span class="n given-name family-name">Rose</span>
In general you can do this:
<span class="n"><span class="given-name family-name">Rose</span></span>
In particular for hCard, since "fn" is required, and the fn is "Rose Rose"
as you said, you have split them up:
<span class="fn n">
> On another note, I didn't previously mention any type on my address,
> but it was imported as a business address for some reason, so I
> wanted to specify the type as home. I don't see any way to do this
> without adding information to my content, .e.g <span
> class="type">Home</span>, which is what I did. It's not a big deal
> for me, but this is the first time I've needed to change the content
> of a page in order to add a microformat, and I thought it might be
> worth mentioning.
This is by design. The point is that the fact that it is a "home" address
is (meta)data, and in general, it's been well demonstrated that invisible
metadata fails (especially when it scales, c.f. meta keywords).
By making you make the decision about "is this information important enough
that I publish it", it means that you think about the accuracy of the
information, much more so than if you were to just throw something into an
invisible field somewhere.
And especially if and *when* the information changes, you, or anyone else
familiar with you, your web page, and the specific information will *notice*
the inconsistency, because it is *visible*, and point it out to you, and
through this feedback loop, the accuracy has a much better chance of being
Also note that you can use abbreviations as many people do for phone
<abbr class="type" title="home">h:</abbr>
Which could be styled/presented as:
Hope that helps!
More information about the microformats-discuss