W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2006

[whatwg] foreign attributes Re: several messages about XML syntax and HTML5

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 5 Dec 2006 23:57:39 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0612052318240.16843@dhalsim.dreamhost.com>
On Tue, 5 Dec 2006, Ian Hickson wrote:
> 
> >    <p id="order1" class="ibm-order">
> >     ....
> >    <p>
> >      has purchased a
> >      <span about="order1" property="ibm-part">
> 
> The key point here being the reference to an earlier blob in the same 
> page, right?
> 
> Interesting. That's something that currently can only really be done 
> with tables, <output>, and hyperlinks; I wonder if we should add a 
> fourth way that is more convenient for Microformat-like data.

Actually it turns out this is a solved problem in Microformats land, known 
as the include-pattern. You would just say:

    <p>
     <span class="ibm-customer" id="cust1">
      <span class="ex-name">Ian Hickson</span>
      (<span class="acme-id">95237032895</span>)
     </span>
    </p>
    ....
    <p class="ibm-order">
     <a href="#cust1" class="include ibm-customer"></a>
     <span class="ibm-part">
      <span class="ex-name">Widget x12</span>
      (part ID <span class="acme-id">295250X12</span>)
     </span>
    </p>

...or some such. A small library (similar to your RDFa library) would be 
useful as a wrapper here to silently treat any elements that use the 
include pattern as includes, so you could say:

   var orders = new mfList('ibm-order');
   for each (var order in orders) {
     if (order.is('ibm-deleted'))
       continue;
     var user = order.get('ibm-customer').get('acme-id');
     var part = order.get('ibm-part').get('acme-id');
     addToList(user, part);
   }

...and it would just work. It wouldn't be much work for someone to make 
such a library.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 5 December 2006 15:57:39 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:31 UTC