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

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