[uf-discuss] Value subproperty - only applies to non-structured properties, right?

brian suda brian.suda at gmail.com
Sun Oct 29 06:41:02 PST 2006


Costello, Roger L. wrote:
> Hi Folks,
>
> Suppose that I want to markup this HTML text using the hCard
> properties:
>
>          John will be our speaker.  Mr. Public will talk about ...
>
> Notice that the name (John Public) is not consecutive, it is scattered.
> Thus, this would not be the correct way to markup the HTML text:
>
> <span class="fn">John will be our speaker.  Mr. Public</span> will talk
> about ...
>
> Doing so would cause the "fn" property to contain irrelevant stuff.
>
> Instead, we identify the relevant stuff using the (microformat-defined)
> "value" subproperty:
>
> <span class="fn">
>         <span class="value">John </span>
>         will be our speaker.  Mr. 
>         <span class="value">Public</span>
> </span>
> will talk about ...
>
> The value of "fn" is the concatenation of the "value" subproperties:
>
>     fn = concat('John ', 'Public') = John Public
>   
--- so far, so good.

> Now, suppose that I am using the "n" property.  It is a structured
> property, and the above HTML text can be marked up without using the
> "value" subproperty:
>
> <span class="n">
>         <span class="given-name">John</span>
>         will be our speaker.  Mr. 
>         <span class="family-name">Public</span>
> </span>
> will talk about ...
>
> Question: am I correct in saying that the "value" subproperty is not
> needed when "n" is used to markup a name that is scattered?
>   
--- i think it is still needed and useful for situations such as:
<tr class="n">
    <td class="family-name">Public,</td>
    <td class="given-name">John Q.</td>
</tr>

you'll still want to extract only a portion of that data.

<tr class="n">
    <td class="family-name"><span class="value">Public</span>,</td>
    <td class="given-name"><span class="value">John</span> Q.</td>
</tr>

It is niche, but still very useful in certain circumstances.
> Let me refer to properties like "fn" as 'non-structured properties'
> (their value is just a string), and properties like "n" as 'structured
> properties' (their value is subelements).
>
> Question: is it a general rule that the "value" subproperty only
> applies to non-structured properties, such as fn, label, etc.?  The
> "value" subproperty does not apply to structured properties, such as n,
> adr, etc?
>   
it can apply to any property. This us what makes it very useful.

The other issue with your example, is that FN is required. So if we go
back to your original example, you can actually MIX the value and
structured n in the same class attribute

<span class="n fn">
        <span class="given-name value">John</span>
        will be our speaker.  Mr. 
        <span class="family-name value">Public</span>
</span>

That will produce:
N:Public;John;;;;
FN:JohnPublic

(there is a small issue with concatenating the two values together, but
you get the idea)

Another example of where the value comes in handy for structured data is
the following:
<div class="adr">
<span class="locality"><abbr title="Saint">St.</abbr> Louis</span>
</div>

Now, without the class="value" you would get a value of  "St. Louis" for
locality. Parsers will not do anything with  ABBR elements that are
children of properties. But there is a way to actually extract the value
'Saint Louis' and that would be to use the class="value"

<div class="adr">
<span class="locality"><abbr title="Saint" class="value">St.</abbr><span
class="value"> Louis</span></span>
</div>
Now you would get 'Saint Louis' for the value of locality.

The class="value" is useful in any situation not just non-structured
properties.

-brian



More information about the microformats-discuss mailing list