[uf-discuss] Value subproperty - only applies to
non-structuredproperties, right?
Costello, Roger L.
costello at mitre.org
Sun Oct 29 07:10:46 PST 2006
Thanks Brian!
The example you gave:
<span class="n fn">
<span class="given-name value">John</span>
will be our speaker. Mr.
<span class="family-name value">Public</span>
</span>
raises a question - does the "value" subproperty (in this example)
apply to "n" or "fn" or both? The "value" subproperty doesn't seem to
have any meaning for "n" in this example.
How does a tool know when a "value" subproperty applies to one
property, but not another?
It seems like there may be cases where it could be difficult to know
what property the "value" subproperty is applying to.
/Roger
-----Original Message-----
From: microformats-discuss-bounces at microformats.org
[mailto:microformats-discuss-bounces at microformats.org] On Behalf Of
brian suda
Sent: Sunday, October 29, 2006 9:41 AM
To: Microformats Discuss
Subject: Re: [uf-discuss] Value subproperty - only applies to
non-structuredproperties, right?
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
_______________________________________________
microformats-discuss mailing list
microformats-discuss at microformats.org
http://microformats.org/mailman/listinfo/microformats-discuss
More information about the microformats-discuss
mailing list