[uf-discuss] Best Practice for fn and n?

Costello, Roger L. costello at mitre.org
Sun Nov 5 07:51:37 PST 2006


Thanks Brian.  Okay, let's see if I can articulate the rules for
determining the value of fn:

Case 1: The contents of the fn-containing element is pure text:

The value of fn is the pure text.

Example: 

<cite class="fn">Mr. John Q. Public, M.D.</cite>

The value of fn is: Mr. John Q. Public, M.D.

Case 2: The fn-containing element has one or more value-containing
elements:

The value of fn is the concatentation of the value-containing element
values.

Example:

<p class="fn">
     <span class="value">John </span>
     is the speaker.  Mr. 
     <span class="value">Public</span>
     will talk on ...
</p>

The value of fn is: concatenation('John ', 'Public') = John Public

Notice the importance of having a space after John

Case 3: The fn-containing element has one or more child elements:

The value of fn is obtained by:
1. concatenate the text outside the child elements with the text inside
the child elements.
2. normalize the resulting string.

Example:

<cite class="fn n">
     <span class="given-name">John</span>
     <span class="family-name">Public</span>
</cite>

The value of fn is:
'
    John
     Public
'

This string is then normalized to:  John Public

Are these the rules?  Am I missing any other cases?

/Roger

-----Original Message-----
From: microformats-discuss-bounces at microformats.org
[mailto:microformats-discuss-bounces at microformats.org] On Behalf Of
Brian Suda
Sent: Sunday, November 05, 2006 9:55 AM
To: Microformats Discuss
Subject: Re: RE: [uf-discuss] Best Practice for fn and n?

On 11/5/06, Costello, Roger L. <costello at mitre.org> wrote:
> Thanks Brian.  I intuitively figured there was something wrong with
> using an empty abbr element.
>
> In fact, my first attempt was to do just as you suggest.  However, I
> realized that there is a problem with that.  Namely, when all the
> values are concatenated together we get this value for fn:
> Mr.JohnQ.PublicM.D.

--- In this case, they would not be concatenated together.
Concatenation only happens with class="value". The white-space between
the nodes is considered as well. In HTML one or more white-space
values (space, tab, return) is considered one space unless you
explicitily use the &nbsp;. So your FN value would actually be:

              Mr.
              John
              Q.
              Public,
              M.D.

With XSLT there is 'normalize-space' which converts that to the string
you would expect. "Mr. John Q. Public, M.D."

White-space is only preseved when you are using <pre> elements.

> One solution would be to add a space after each part:

--- in this case, it is not needed.

> Any suggestions on how to solve this problem?

--- i don't think it is a problem, unless you WANT to preserve the
white-space, then in that case, i would suggest using the <pre>
element.

-brian

-- 
brian suda
http://suda.co.uk
_______________________________________________
microformats-discuss mailing list
microformats-discuss at microformats.org
http://microformats.org/mailman/listinfo/microformats-discuss



More information about the microformats-discuss mailing list