hcard-faq: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
m (typos)
(reformatted with mediawiki level 3 headings for questions, bits of cleanup, removed a duplicate question)
Line 1: Line 1:
= hCard FAQ =
<h1> hCard FAQ </h1>


This page is for documenting Q&A about [[hcard|hCard]].  If you have a new question to ask, Please consider first asking your question on the [http://microformats.org/mailman/listinfo/microformats-discuss/ microformats-discuss] list.
This page is for documenting Q&A about [[hcard|hCard]].  If you have a new question to ask, Please consider first asking your question on the [http://microformats.org/mailman/listinfo/microformats-discuss/ microformats-discuss] list.


== Q&A ==
<h2> Q&A </h2>


# ''Should I use the more semantic <address> element for my hCards?''
=== Should I use ADDRESS for hCards ===
#* Yes the <address> element is more semantic, but it is ''too'' specifically semantic for most hCard uses.  The poorly named <address> element really means <contact-info-for-this-web-page>.  The [http://www.w3.org/TR/html401/struct/global.html#h-7.5.6 HTML4 definition of the ADDRESS element] says it is used "to supply contact information for a document or a major part of a document such as a form."  Therefore <address> should be used for an hCard ONLY IF that hCard represents the contact information for the page or major part thereof.  One example of such a usage is on [http://tantek.com/log/ Tantek's blog].  Another way of saying this is the following two statements: Every <address> on a page SHOULD be an hCard. But not every hCard should be an <address>. <br/> In short, '''DO NOT''' use <address> to markup addresses in general.  Only use it to markup the contact information for the page (or major part thereof), and when doing so, use it to markup ''the entire'' contact information (via <address class="vcard">), not just the address of the contact.
''Should I use the more semantic <code><nowiki><address></nowiki></code> element for my hCards?''
# ''Why is it necessary to put class name "url" on URL elements in the hCard when those hyperlinks already start with "http://", and that is enough to distinguish them from email links?''
* Yes the <code><nowiki><address></nowiki></code> element is more semantic, but it is ''too'' specifically semantic for most hCard uses.  The poorly named <code><nowiki><address></nowiki></code> element really means <contact-info-for-this-web-page>.  The [http://www.w3.org/TR/html401/struct/global.html#h-7.5.6 HTML4 definition of the ADDRESS element] says it is used "to supply contact information for a document or a major part of a document such as a form."  Therefore <code><nowiki><address></nowiki></code> should be used for an hCard ONLY IF that hCard represents the contact information for the page or major part thereof.  One example of such a usage is on [http://tantek.com/log/ Tantek's blog].  Another way of saying this is the following two statements: Every <address> on a page SHOULD be an hCard. But not every hCard should be an <code><nowiki><address></nowiki></code>. <br /> In short, '''DO NOT''' use <code><nowiki><address></nowiki></code> to markup addresses in general.  Only use it to markup the contact information for the page (or major part thereof), and when doing so, use it to markup ''the entire'' contact information (via <address class="vcard">), not just the address of the contact.
#* The classname "url" is necessary to explicitly distinguish hyperlinks that are URL elements for the hCard, from email hyperlinks, as well as hyperlinks to photos, or other random hyperlinks that happen to be inside the hCard.
 
# ''I already have a vCard that I keep up-to-date. I don't want to change any references to it because it might break something else, what can I do?''
=== Why is url property necessary ===
#* You can use .HTACCESS to rewrite links to your vCard to a webservice that converts a page to the vCard dynamically, to do this you need to add something similar to your .htaccess file
''Why is it necessary to put class name "url" on URL elements in the hCard when those hyperlinks already start with "http://", and that is enough to distinguish them from email links?''
* The classname "url" is necessary to explicitly distinguish hyperlinks that are URL elements for the hCard, from email hyperlinks, as well as hyperlinks to photos, or other random hyperlinks that happen to be inside the hCard.
 
=== How do I support an existing vCard URL ===
''I already have a vCard that I keep up-to-date. I don't want to change any references to it because it might break something else, what can I do?''
* You can use .HTACCESS to rewrite links to your vCard to a webservice that converts a page to the vCard dynamically, to do this you need to add something similar to your .htaccess file
<pre>
<pre>
RewriteRule ^path/to/old.vcf http://suda.co.uk/projects/X2V/get-vcard.php\?uri=http://example.com/hCard_encoded.htm&filename=old.vcf
RewriteRule ^path/to/old.vcf http://suda.co.uk/projects/X2V/get-vcard.php\?uri=http://example.com/hCard_encoded.htm&filename=old.vcf
Line 21: Line 26:
Redirect /path/to/old.vcf http://suda.co.uk/projects/X2V/get-vcard.php?uri=http://example.com/hCard_encoded.htm&filename=old.vcf
Redirect /path/to/old.vcf http://suda.co.uk/projects/X2V/get-vcard.php?uri=http://example.com/hCard_encoded.htm&filename=old.vcf
</pre>
</pre>
<ol start="4"><li>''Is there a list of all hCard properties which can be plural?</li>
 
=== What are plural hCard properties ===
''Is there a list of all hCard properties which can be plural?''<br />
''Is there a list of all the properties which can have multiple instances?''
* There is the [[hcard#Property_List|list of hCard properties]], and the list of [[hcard#Singular_properties|singular hCard properties]].  Everything that is not singular is plural.  This list was presented explicitly (after much analysis of RFC2426) because it was too hard to read RFC2426 and reliably grok which properties were singular vs. plural.
 
Old previous answer:
* We have avoided *duplicating* (or providing a shortcut for) the "can this property occur multiple times or not" deliberately in order to avoid repeating a constraint from RFC 2426 vCard, and thus potentially getting it wrong.  Here is the way to determine whether or not a particular property can occur multiple times (is a plural property / may have multiple instances or values).
* We have avoided *duplicating* (or providing a shortcut for) the "can this property occur multiple times or not" deliberately in order to avoid repeating a constraint from RFC 2426 vCard, and thus potentially getting it wrong.  Here is the way to determine whether or not a particular property can occur multiple times (is a plural property / may have multiple instances or values).
*# Check the [[hcard-profile|hCard XMDP profile]] for the property definition.
* Check the [[hcard-profile|hCard XMDP profile]] for the property definition.
*# If the property definition references a plural form in RFC 2426 (e.g. honorific-suffix references honorific suffixes), then the property is a plural property.
* If the property definition references a plural form in RFC 2426 (e.g. honorific-suffix references honorific suffixes), then the property is a plural property.
*# Else go check the referenced section in RFC 2426 which should state explicitly whether or not the property is plural or singular.
* Else go check the referenced section in RFC 2426 which should state explicitly whether or not the property is plural or singular.
*# Else (if RFC 2426 is *not* explicit) then the property is plural.
* Else (if RFC 2426 is *not* explicit) then the property is plural.
</ol>


<ol start="5"><li>''What does FN stand for?''
=== What does FN stand for ===
 
''What does FN stand for?''
* FN stands for "Formatted Name." From Section 3.1.1 of the RFC:
* FN stands for "Formatted Name." From Section 3.1.1 of the RFC:
<blockquote>Type purpose: To specify the formatted text corresponding to the name of the object the vCard represents.</blockquote>
<blockquote>Type purpose: To specify the formatted text corresponding to the name of the object the vCard represents.</blockquote>
* The reasoning behind this seems to be that, while N gives us a structured name, FN gives us the human-readable, formatted name which is assembled from its structured parts in a culturally dependant way.
* The reasoning behind this seems to be that, while N gives us a structured name, FN gives us the human-readable, formatted name which is assembled from its structured parts in a culturally dependant way.
</li>
 
<li>''How do you represent gender in hCard?''
=== How is gender represented ===
''How do you represent gender in hCard?''
* There is no GENDER property in [http://www.ietf.org/rfc/rfc2426.txt vCard RFC2426]. [[hcard|hCard]] is following the schema from vCard for interoperability reasons.  If you want, it is possible to represent gender implicitly in the honorific-prefix field, e.g. Mr. for male, and Ms. for female:
* There is no GENDER property in [http://www.ietf.org/rfc/rfc2426.txt vCard RFC2426]. [[hcard|hCard]] is following the schema from vCard for interoperability reasons.  If you want, it is possible to represent gender implicitly in the honorific-prefix field, e.g. Mr. for male, and Ms. for female:
<pre><nowiki>
<pre><nowiki>
Line 43: Line 56:
<span class="honorific-prefix">Ms.</span>
<span class="honorific-prefix">Ms.</span>
</nowiki></pre>
</nowiki></pre>
</li>
 
<li>''Is it OK for an hCard node to contain extra elements?''
Note that there is also a [http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/vcard_name.asp page on MSDN that mentions vCard and "gender"]. Not sure what to make of that.
 
=== Can an hCard contains extra elements ===
''Is it OK for an hCard node to contain extra elements?''
* Yes, parsers will ignore anything they don't understand.
* Yes, parsers will ignore anything they don't understand.
</li><li>''Can I automatically add GEO from an address when transfoming an hCard to vCard if it is not present?''
 
* No, an address represents a building which is a polygon, whereas a GEO only represents a single point</li>
=== Can a GEO be inferred from an ADR in an hCard ===
<li>''X2V doesn't convert my email address correctly, it is in the form href="FirstName LastName &lt;Email@Address.com&gt;"''
''Can I automatically add GEO from an address when transfoming an hCard to vCard if it is not present?''
* No, an address represents a building which is a polygon, whereas a GEO only represents a single point
 
=== X2V does not convert email with name as plain text ===
''X2V doesn't convert my email address correctly, it is in the form href="FirstName LastName &lt;Email@Address.com&gt;"''
* While that form of email address works for some programs such as outlook, it is not a valid mailto: value (see [http://www.faqs.org/rfcs/rfc2368.html RFC2368]) the FirstName and LastName should be omitted.  
* While that form of email address works for some programs such as outlook, it is not a valid mailto: value (see [http://www.faqs.org/rfcs/rfc2368.html RFC2368]) the FirstName and LastName should be omitted.  
</li>
 
<li>''What properties are required in an hCard?''
=== What hCard properties are required ===
''What properties are required in an hCard?''
* The only required properties are 'fn' (the formatted name) and 'n' (the structured name), but 'n' can under certain circumstances be inferred from the <code>fn</code> property. See the [[hcard#Implied_.22n.22_Optimization|Implied N Optimization]] for details.
* The only required properties are 'fn' (the formatted name) and 'n' (the structured name), but 'n' can under certain circumstances be inferred from the <code>fn</code> property. See the [[hcard#Implied_.22n.22_Optimization|Implied N Optimization]] for details.


<li>''If I use the 'n' property, do I have to use ALL of the sub-properties?''
=== Does N property require all subproperties ===
''If I use the 'n' property, do I have to use ALL of the sub-properties?''
* No, You can use as many or as few as you need to mark-up the name, but at a minimum you should at least use the 'given-name' and 'family-name' sub-properties if at all possible.  If all you have is a nickname/handle/userid, then consider simply marking it up as an 'fn' property and taking advantage of the [http://microformats.org/wiki/hcard#Implied_.22nickname.22_Optimization Implied "nickname" Optimization].
* No, You can use as many or as few as you need to mark-up the name, but at a minimum you should at least use the 'given-name' and 'family-name' sub-properties if at all possible.  If all you have is a nickname/handle/userid, then consider simply marking it up as an 'fn' property and taking advantage of the [http://microformats.org/wiki/hcard#Implied_.22nickname.22_Optimization Implied "nickname" Optimization].
<li>''Do the 'fn' and 'n' properties have to be on the same element?''
 
=== Do FN and N need to be on same element ===
''Do the 'fn' and 'n' properties have to be on the same element?''
* No, you can have two separate elements, for example:
* No, you can have two separate elements, for example:
<pre><nowiki>
<pre><nowiki>
Line 70: Line 94:
</p>
</p>
</nowiki></pre>
</nowiki></pre>
<li>''Is there a way to convert a vCard to an hCard?''
 
=== How do you convert a vCard to an hCard ===
''Is there a way to convert a vCard to an hCard?''
* There is no canonical conversion from a vCard to an hCard because you can construct an hCard in many different ways while expressing the same semantics.  If you would like to recommend a suggested template hCard to use when displaying vCards in a browser, please propose it to the [http://microformats.org/discuss mailing list].
* There is no canonical conversion from a vCard to an hCard because you can construct an hCard in many different ways while expressing the same semantics.  If you would like to recommend a suggested template hCard to use when displaying vCards in a browser, please propose it to the [http://microformats.org/discuss mailing list].
<li>''Are descendants recognized in a microformat property?''
 
=== Are descendant elements recognized in a microformat ===
''Are descendants recognized in a microformat property?''
* Yes, for example:
* Yes, for example:
<pre><nowiki>
<pre><nowiki>
Line 78: Line 106:
</nowiki></pre>
</nowiki></pre>
The output would be "United States of America".
The output would be "United States of America".
<li>''Do properties like TEL use all descendants?'' e.g. <pre><nowiki><span class="tel"><span class="type">Home</span>:<span class="value">+1.234.567.8900</span></span></nowiki></pre><br>''Shouldn't that output be "TEL:Home: +1.234.567.8900"?''
 
=== Do properties like TEL use all descendants ===
''Do properties like TEL use all descendants?'' e.g. <pre><nowiki><span class="tel"><span class="type">Home</span>:<span class="value">+1.234.567.8900</span></span></nowiki></pre><br>''Shouldn't that output be "TEL:Home: +1.234.567.8900"?''
* No. class="value" is used to denote a sub-element which is used for the value of the property.  See [[hcard#Value_excerpting|Value excerpting]] for more details.
* No. class="value" is used to denote a sub-element which is used for the value of the property.  See [[hcard#Value_excerpting|Value excerpting]] for more details.


<li>''Can you have multiple class="value" elements inside a property and what happens to them?''
=== Can you have multiple value elements ===
''Can you have multiple class="value" elements inside a property and what happens to them?''
* Sure, for example:
* Sure, for example:
<code><nowiki><span class="tel"><span class="type">Home</span>:<span class="value">+1</span>.<span class="value">234</span>.<span class="value">567</span>.<span class="value">8900</span></span>
<code><nowiki><span class="tel"><span class="type">Home</span>:<span class="value">+1</span>.<span class="value">234</span>.<span class="value">567</span>.<span class="value">8900</span></span>
</nowiki></code><br> would output: "+12345678900".
</nowiki></code><br> would output: "+12345678900".
<li id="nesting-properties">''Can you put properties on the same element as the root class for a microformat? E.g. class="vcard fn"?''
 
=== Can you mix properties and the root class name ===
''<span id="nesting-properties">Can you put properties on the same element as the root class for a microformat? E.g. class="vcard fn"?</span>''
* No, for several reasons:
* No, for several reasons:
** From a data format design perspective, breaking strict containment is bad design, and is a known anti-pattern.
** From a data format design perspective, breaking strict containment is bad design, and is a known anti-pattern.
** It breaks the simple contextual CSS selector rule for finding and styling property values: .rootname .propertyname which will make it more difficult to write scoped CSS for the properties.  For more on why this is important see the [[faq#Class_interactions|microformats FAQ regarding class interactions]].
** It breaks the simple contextual CSS selector rule for finding and styling property values: .rootname .propertyname which will make it more difficult to write scoped CSS for the properties.  For more on why this is important see the [[faq#Class_interactions|microformats FAQ regarding class interactions]].
** It will result in more confusion for parsers which may be parsing nested microformats.
** It will result in more confusion for parsers which may be parsing nested microformats.
<li>''Can singular sub-properties be mixed with parents?''
 
=== Can you mix a property and its subproperties ===
''Can singular sub-properties be mixed with parents?''
* No, all sub-properties MUST be on elements inside their parents.
* No, all sub-properties MUST be on elements inside their parents.
<li>''What happened to the Query String on my email address?''
 
=== Can you use query strings on email ===
''What happened to the Query String on my email address?''
* Query strings are removed from email addresses because they are not valid for importing to vCards
* Query strings are removed from email addresses because they are not valid for importing to vCards
<li> ''Is the list of possible types for an ADR and TEL case sensitive?''
 
=== Are ADR and TEL types case sensitive ===
''Is the list of possible types for an ADR and TEL case sensitive?''
* No, enumerated values are case-INsensitive, therefore Home, home, HOME, etc. are all equivalent.
* No, enumerated values are case-INsensitive, therefore Home, home, HOME, etc. are all equivalent.


<li>''What happens to the GEO sub-properties when GEO is used with ABBR?''
=== How does GEO work with ABBR ===
''What happens to the GEO sub-properties when GEO is used with ABBR?''
* The GEO property can be represented two different ways:
* The GEO property can be represented two different ways:
<pre>
<pre>
Line 111: Line 151:
When used with an &lt;abbr&gt; element the latitude and longitude are seperated by a semicolon.
When used with an &lt;abbr&gt; element the latitude and longitude are seperated by a semicolon.


<li>''Why is the root class="vcard" and not 'hcard'?''
=== Why is the root class name vcard ===
''Why is the root class="vcard" and not 'hcard'?''
* The reason is historical, hCard is based off of the vCard specification.
* The reason is historical, hCard is based off of the vCard specification.


<li>''How do I mark-up a phone extension in hCard?''
=== How do you markup a phone extension ===
There dosn't seem to be a way to declare a telephone extension in the vCard RFC2426 spec, the suggested way is currently:
''How do I mark-up a phone extension in hCard?''
There doesn't seem to be a way to declare a telephone extension in the vCard RFC2426 spec, the suggested way is currently:
<pre><nowiki>
<pre><nowiki>
<span class="tel">
<span class="tel">
Line 121: Line 163:
</span>
</span>
</nowiki></pre>
</nowiki></pre>
<li>''How do I encode my IM account in hCard?''
 
=== How do you encode IM accounts ===
''How do I encode my IM account in hCard?''
* see [[hcard-examples#New_Types_of_Contact_Info|hCard examples: New Types of Contact Info]]
* see [[hcard-examples#New_Types_of_Contact_Info|hCard examples: New Types of Contact Info]]
<li>''How do you make an hCard for the deceased?''
 
=== Can you hCard the deceased ===
''How do you make an hCard for the deceased?''
* vCards were never designed to handle date-of-death, please refer to the biographical or [[genealogy-formats]] microformat
* vCards were never designed to handle date-of-death, please refer to the biographical or [[genealogy-formats]] microformat
<li>''Is there a list of all the properties which can have multiple instances?''
 
* If the property is plural in RFC2426, then multiple values are allowed.
=== Any plans for xparams ===
* If multiple values aren't explicitly forbidden for the property (see RFC2426), then multiple values are allowed.
''Are there plans to include x-parameters in future versions of hCard?''
<li>''Are there plans to include x-parameters in future versions of hCard?''
* No. The problem is that each of these x-parameters are vendor specific and are not part of the RFC. Secondly, there is no way to be 100% sure that 'x-foobar' is not just a content-specific HTML class name that the publisher is using for CSS styling.
* No. The problem is that each of these x-parameters are vendor specific and are not part of the RFC. Secondly, there is no way to be 100% sure that 'x-foobar' is not just a content-specific HTML class name that the publisher is using for CSS styling.


<li>''What constitutes a "word" for the purpose of 'implied-n optimization'?''
 
=== What is a word in implied optimizations ===
''What constitutes a "word" for the purpose of 'implied-n optimization'?''
* "N" can be implied from "FN" when the content of "FN" is broken into two "words" separated by whitespace. For this purpose, a "word" is any sequence of non-whitespace characters including but not limited to low- and high-range alphanumerics and punctuation. A "word" can be characterised by the following regular expression: <pre><nowiki>/\S+/</nowiki></pre>
* "N" can be implied from "FN" when the content of "FN" is broken into two "words" separated by whitespace. For this purpose, a "word" is any sequence of non-whitespace characters including but not limited to low- and high-range alphanumerics and punctuation. A "word" can be characterised by the following regular expression: <pre><nowiki>/\S+/</nowiki></pre>


<li>"My website is not in English and i want the tooltips to be in my native language"
=== How do you create non English tooltips ===
"My website is not in English and i want the tooltips to be in my native language"
* Properties such as class="type" require an enumerated list of English words. It is possible to use your native language for the displaying tooltip, but still use the English work for the class="type" without it being shown.
* Properties such as class="type" require an enumerated list of English words. It is possible to use your native language for the displaying tooltip, but still use the English work for the class="type" without it being shown.
<pre><nowiki>
<pre><nowiki>
Line 145: Line 193:
</pre>
</pre>
Having an span with a title attribute inside the abbr element will only display the title on the span, where you have the text (your native word for home here).
Having an span with a title attribute inside the abbr element will only display the title on the span, where you have the text (your native word for home here).
</ol>

Revision as of 23:05, 4 August 2006

hCard FAQ

This page is for documenting Q&A about hCard. If you have a new question to ask, Please consider first asking your question on the microformats-discuss list.

Q&A

Should I use ADDRESS for hCards

Should I use the more semantic <address> element for my hCards?

  • Yes the <address> element is more semantic, but it is too specifically semantic for most hCard uses. The poorly named <address> element really means <contact-info-for-this-web-page>. The HTML4 definition of the ADDRESS element says it is used "to supply contact information for a document or a major part of a document such as a form." Therefore <address> should be used for an hCard ONLY IF that hCard represents the contact information for the page or major part thereof. One example of such a usage is on Tantek's blog. Another way of saying this is the following two statements: Every <address> on a page SHOULD be an hCard. But not every hCard should be an <address>.
    In short, DO NOT use <address> to markup addresses in general. Only use it to markup the contact information for the page (or major part thereof), and when doing so, use it to markup the entire contact information (via <address class="vcard">), not just the address of the contact.

Why is url property necessary

Why is it necessary to put class name "url" on URL elements in the hCard when those hyperlinks already start with "http://", and that is enough to distinguish them from email links?

  • The classname "url" is necessary to explicitly distinguish hyperlinks that are URL elements for the hCard, from email hyperlinks, as well as hyperlinks to photos, or other random hyperlinks that happen to be inside the hCard.

How do I support an existing vCard URL

I already have a vCard that I keep up-to-date. I don't want to change any references to it because it might break something else, what can I do?

  • You can use .HTACCESS to rewrite links to your vCard to a webservice that converts a page to the vCard dynamically, to do this you need to add something similar to your .htaccess file
RewriteRule ^path/to/old.vcf http://suda.co.uk/projects/X2V/get-vcard.php\?uri=http://example.com/hCard_encoded.htm&filename=old.vcf

Now you shouldn't have to do anything else, all links to the "old.vcf" are redirected to the webservice and will return a new vCard that is dynamially generated from your page.

I think that using 'Redirect' is better than using mod_rewrite (is not enabled on some hosts) --Robert Bachmann

Redirect /path/to/old.vcf http://suda.co.uk/projects/X2V/get-vcard.php?uri=http://example.com/hCard_encoded.htm&filename=old.vcf

What are plural hCard properties

Is there a list of all hCard properties which can be plural?
Is there a list of all the properties which can have multiple instances?

  • There is the list of hCard properties, and the list of singular hCard properties. Everything that is not singular is plural. This list was presented explicitly (after much analysis of RFC2426) because it was too hard to read RFC2426 and reliably grok which properties were singular vs. plural.

Old previous answer:

  • We have avoided *duplicating* (or providing a shortcut for) the "can this property occur multiple times or not" deliberately in order to avoid repeating a constraint from RFC 2426 vCard, and thus potentially getting it wrong. Here is the way to determine whether or not a particular property can occur multiple times (is a plural property / may have multiple instances or values).
  • Check the hCard XMDP profile for the property definition.
  • If the property definition references a plural form in RFC 2426 (e.g. honorific-suffix references honorific suffixes), then the property is a plural property.
  • Else go check the referenced section in RFC 2426 which should state explicitly whether or not the property is plural or singular.
  • Else (if RFC 2426 is *not* explicit) then the property is plural.

What does FN stand for

What does FN stand for?

  • FN stands for "Formatted Name." From Section 3.1.1 of the RFC:

Type purpose: To specify the formatted text corresponding to the name of the object the vCard represents.

  • The reasoning behind this seems to be that, while N gives us a structured name, FN gives us the human-readable, formatted name which is assembled from its structured parts in a culturally dependant way.

How is gender represented

How do you represent gender in hCard?

  • There is no GENDER property in vCard RFC2426. hCard is following the schema from vCard for interoperability reasons. If you want, it is possible to represent gender implicitly in the honorific-prefix field, e.g. Mr. for male, and Ms. for female:
<span class="honorific-prefix">Mr.</span>

or

<span class="honorific-prefix">Ms.</span>

Note that there is also a page on MSDN that mentions vCard and "gender". Not sure what to make of that.

Can an hCard contains extra elements

Is it OK for an hCard node to contain extra elements?

  • Yes, parsers will ignore anything they don't understand.

Can a GEO be inferred from an ADR in an hCard

Can I automatically add GEO from an address when transfoming an hCard to vCard if it is not present?

  • No, an address represents a building which is a polygon, whereas a GEO only represents a single point

X2V does not convert email with name as plain text

X2V doesn't convert my email address correctly, it is in the form href="FirstName LastName <Email@Address.com>"

  • While that form of email address works for some programs such as outlook, it is not a valid mailto: value (see RFC2368) the FirstName and LastName should be omitted.

What hCard properties are required

What properties are required in an hCard?

  • The only required properties are 'fn' (the formatted name) and 'n' (the structured name), but 'n' can under certain circumstances be inferred from the fn property. See the Implied N Optimization for details.

Does N property require all subproperties

If I use the 'n' property, do I have to use ALL of the sub-properties?

  • No, You can use as many or as few as you need to mark-up the name, but at a minimum you should at least use the 'given-name' and 'family-name' sub-properties if at all possible. If all you have is a nickname/handle/userid, then consider simply marking it up as an 'fn' property and taking advantage of the Implied "nickname" Optimization.

Do FN and N need to be on same element

Do the 'fn' and 'n' properties have to be on the same element?

  • No, you can have two separate elements, for example:
<p class="vcard">My name is
<span class="n">
<span class="honorific-prefix">Mr.</span>
<span class="given-name">John</span>
<span class="additional-name">Q</span>
<span class="family-name">Public</span>
</span>
but you can just call me
<span class="fn">Johnny</span>
</p>

How do you convert a vCard to an hCard

Is there a way to convert a vCard to an hCard?

  • There is no canonical conversion from a vCard to an hCard because you can construct an hCard in many different ways while expressing the same semantics. If you would like to recommend a suggested template hCard to use when displaying vCards in a browser, please propose it to the mailing list.

Are descendant elements recognized in a microformat

Are descendants recognized in a microformat property?

  • Yes, for example:
<span class="country-name">United States <small>of</small> America</span>

The output would be "United States of America".

Do properties like TEL use all descendants

Do properties like TEL use all descendants? e.g.

<span class="tel"><span class="type">Home</span>:<span class="value">+1.234.567.8900</span></span>


Shouldn't that output be "TEL:Home: +1.234.567.8900"?

  • No. class="value" is used to denote a sub-element which is used for the value of the property. See Value excerpting for more details.

Can you have multiple value elements

Can you have multiple class="value" elements inside a property and what happens to them?

  • Sure, for example:

<span class="tel"><span class="type">Home</span>:<span class="value">+1</span>.<span class="value">234</span>.<span class="value">567</span>.<span class="value">8900</span></span>
would output: "+12345678900".

Can you mix properties and the root class name

Can you put properties on the same element as the root class for a microformat? E.g. class="vcard fn"?

  • No, for several reasons:
    • From a data format design perspective, breaking strict containment is bad design, and is a known anti-pattern.
    • It breaks the simple contextual CSS selector rule for finding and styling property values: .rootname .propertyname which will make it more difficult to write scoped CSS for the properties. For more on why this is important see the microformats FAQ regarding class interactions.
    • It will result in more confusion for parsers which may be parsing nested microformats.

Can you mix a property and its subproperties

Can singular sub-properties be mixed with parents?

  • No, all sub-properties MUST be on elements inside their parents.

Can you use query strings on email

What happened to the Query String on my email address?

  • Query strings are removed from email addresses because they are not valid for importing to vCards

Are ADR and TEL types case sensitive

Is the list of possible types for an ADR and TEL case sensitive?

  • No, enumerated values are case-INsensitive, therefore Home, home, HOME, etc. are all equivalent.

How does GEO work with ABBR

What happens to the GEO sub-properties when GEO is used with ABBR?

  • The GEO property can be represented two different ways:

<span class="geo">
<span class="latitude">123.45</span>
<span class="longitude">67.89</span>
</span>

<abbr class="geo" title="123.45;67.89">My House</abbr>

When used with an <abbr> element the latitude and longitude are seperated by a semicolon.

Why is the root class name vcard

Why is the root class="vcard" and not 'hcard'?

  • The reason is historical, hCard is based off of the vCard specification.

How do you markup a phone extension

How do I mark-up a phone extension in hCard? There doesn't seem to be a way to declare a telephone extension in the vCard RFC2426 spec, the suggested way is currently:

<span class="tel">
    <span class="type">cell</span>: <span class="value">800 555-1212 x 1234</span>
</span>

How do you encode IM accounts

How do I encode my IM account in hCard?

Can you hCard the deceased

How do you make an hCard for the deceased?

  • vCards were never designed to handle date-of-death, please refer to the biographical or genealogy-formats microformat

Any plans for xparams

Are there plans to include x-parameters in future versions of hCard?

  • No. The problem is that each of these x-parameters are vendor specific and are not part of the RFC. Secondly, there is no way to be 100% sure that 'x-foobar' is not just a content-specific HTML class name that the publisher is using for CSS styling.


What is a word in implied optimizations

What constitutes a "word" for the purpose of 'implied-n optimization'?

  • "N" can be implied from "FN" when the content of "FN" is broken into two "words" separated by whitespace. For this purpose, a "word" is any sequence of non-whitespace characters including but not limited to low- and high-range alphanumerics and punctuation. A "word" can be characterised by the following regular expression:
    /\S+/

How do you create non English tooltips

"My website is not in English and i want the tooltips to be in my native language"

  • Properties such as class="type" require an enumerated list of English words. It is possible to use your native language for the displaying tooltip, but still use the English work for the class="type" without it being shown.
<abbr class="type" title="home">
 <span title="(your native word for home here)">
  to my home
 </span>
</abbr>

Having an span with a title attribute inside the abbr element will only display the title on the span, where you have the text (your native word for home here).