rel profile

From Microformats Wiki
Revision as of 11:05, 1 May 2013 by ChristopheDucamp (talk | contribs) ([fr: to be translated])
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Cette page a démarré sur rel-profile et peut être traduite ici. To be translated


rel="profile" was originally introduced in a draft of XHTML 2.0 (citation needed) as a result of a proposal by Tantek Çelik during an early HTML Working Group meeting (sometime in the early 2000s, working group minutes citation needed) to solve the problem of profile URLs being limited to a single one-off invisible attribute of the <head> element.

This same meaning, that of a link to a metadata profile for the current document, is has been incorporated into XMDP since HTML5 drops the "profile" attribute. See also xmdp-brainstorming, in particular, when microformats may be in use.

Editor
Tantek Çelik

processing model

In brief: the head[profile] takes precedence per current XMDP description (for backward compat), and then the same first defined rules apply, that is in cases where more than one profile from an <a rel="profile"> defines the same term, first definition wins.

More specifically:

  • All processors MUST use the DOM of a document parsed per HTML5 or an algorithm that provides an equivalent result. All references to elements, attributes, accessing, traversing refer to in the context of the DOM. All processing steps are required (MUST) unless otherwise specified.

Processing model for determing the profile dictionary for a document:

  1. rel-profile processors start with an empty profile dictionary for the document consisting of terms and respective definitions and list of links.
  2. rel-profile processors SHOULD for backward compatibility access the 'profile' attribute of the 'head' element, treat it as a space separated list of profile document absolute (fully-qualified) URLs, and process them in order as profile links.
  3. rel-profile processors MUST access 'link' elements in the 'head' element in document order and if their 'rel' attribute, when treated as a space separated set of keywords, contains "profile", process the 'link' element's 'href' attribute per HTML5 URL resolution rules as a profile link.
  4. process these profile links into a profile dictionary for the document.

Processing model to process a profile link into a profile dictionary

  1. retrieve the profile link as a profile document
  2. parse the profile document per HTML5 parsing or an algorithm that provides an equivalent DOM result and use that DOM for further processing of the profile document.
  3. access 'dl' elements in the profile document in document order and if their 'class' attribute, when treated as a space separated set of keywords, contains "profile", process the dl as a profile definition list.
  4. access 'dt' children of the profile definition list in document order and if their 'id' attribute is non-empty, process the dt as a profile term
  5. access the text contents of the profile definition term, and if it is not present in the dictionary table, add it and process following sibling 'dd' elements as profile term descriptions until the next 'dt' element or the end of the profile definition list whichever comes first.
  6. access the text contents of the profile term descriptions, concatenate them with an intervening whitespace " " character, and place them in the profile dictionary as the definition corresponding to the profile definition term
  7. start with a new list of links. access the hyperlink (a href) descendants of the profile term descriptions in document order and for each one, if their 'rel' attribute, when treated as a space separated set of keywords, contains "help", process its 'href' attribute per HTML5 URL resolution rules and add it to a the list of links. Place the complete list of links from this step for this profile defintion term into the profile dictionary as its corresponding list of links.

Processing model to process rel-profile hyperlinks into a profile dictionary for an element.

  1. for an element, start with an empty profile dictionary for the element
  2. retrieve all children hyperlinks (a href elements) in document order and if their 'rel' attribute, when treated as a space separated set of keywords, contains "profile", process the 'a' element's 'href' attribute per HTML5 URL resolution rules as a profile link.
  3. process these profile links into a profile dictionary for the element

This process creates a profile dictionary for the document, and for each element.

Each element also has an effective profile dictionary, which is determined by combining the profile dictionary of the element and all its ancestors. If a term is defined in multiple profile dictionaries, the definition nearest to the element takes precedence.

The definition of a term within the context of an element may be determined by looking it up in the effective profile dictionary for that element. If the term is not present, then it is undefined.

advantages

Using rel="profile" has numerous advantages aside from the obvious and originally intended advantage of enabling HTML5 documents to not depend on the "profile" attribute of the <head> element, and simply use the existing <link> element instead. E.g.

<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="profile" href="http://microformats.org/profile/hcard" />

Most of these advantages come from the ability to use <a> hyperlinks instead of (or in addition to) <head> and <link> elements and are based on the microformats principles.

visibility

The idea is that a document that uses a particular microformat, e.g. hCard, can explicitly link to the profile for that microformat and indicate the profile relationship, via existing visible content hyperlink text such as "This document uses hCard", or an hCard badge image, both of which have been seen in real world web content. E.g.

<div class="vcard">
 Here is my 
 <a rel="profile" href="http://microformats.org/profile/hcard">hCard</a>:
 <div class="fn">Tantek Çelik</div>
 <div class="org">microformats.org</div>
</div>

The microformats root class name 'vcard' as well as properties 'fn' and 'org' are defined by the profile http://microformats.org/profile/hcard.

modularity

Hyperlinks with rel="profile" provide the potential for contextual definitions of terms. That is, we define vocabularies included by a hyperlink with rel="profile" to apply only within the context of the hyperlink (the parent element and all its descendants).

These fragments of self-defining portable semantic HTML enable more modular HTML for transclusion and other purposes.

additional languages

Atom

In Atom the link element can be used inside the feed element to link to a profile for microformats used in the feed. e.g.:

<feed>
 <link rel="profile" href="http://microformats.org/profile/hcard" />
 ...
</feed>

To scope a profile to a specific Atom entry use <link rel="profile" /> inside that <entry> element, e.g.:

<entry>
 <link rel="profile" href="http://microformats.org/profile/hcard" />
 ...
</entry>

implementations

Cognition has supported rel=profile since March 2008. Cognition has two microformat parsing modes:

  • Strict mode: pages using microformats are required to include a well-known profile URI for each microformat they use, essentially as a "flag" to enable parsing of that microformat.
  • Loose mode (default): most microformats will be parsed without a profile being explicitly included (though authors are still recommended to include profile URIs for any microformats they use). Some obscure microformats (e.g. XFN 1.0, XEN) still require a profile URI to work.

see also