W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2011

[whatwg] Extensible microdata attributes

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Sun, 12 Jun 2011 23:41:09 -0700
Message-ID: <BANLkTi=YGG77TR0-eJ0UR1P1NovPcfmoig@mail.gmail.com>
On Sat, Jun 11, 2011 at 4:20 AM, Brett Zamir <brettz9 at yahoo.com> wrote:
> For example, to take a water-damaged text (e.g., for the TEI element
> http://www.tei-c.org/release/doc/tei-p5-doc/en/html/ref-damage.html ) which
> in TEI could be expressed as:
e> <damage agent="water" xmlns="http://www.tei-c.org/ns/1.0/">Some water
> damaged words</damage>
> might be represented currently in Microdata as:
> <span itemprop="damage" itemscope=""
> itemtype="http://www.tei-c.org/ns/1.0/">
> <meta itemprop="agent" content="water"/>
> ? ?Some water damaged words
> </span>

This still wouldn't quite work.  Embedded Microdata has no
relationship with the surrounding DOM - the only meaning carried is
whatever is actually being denoted as Microdata.  So, in the above
example, you're indicating that there is some water damage, but not
what is damaged.

If you wanted to address this properly, you'd need to format it like this:

<span itemprop=damage itemscope itemtype="http://www.tei-c.org/ns/1.0/">
  <meta itemprop=agent content=water>
  <span itemprop=subject>Some water damaged words</span>

This way, when you extract the Microdata, you get an item that looks like:

{ "items": [
    { "properties": {
        "damage": [
          { "type": "...",
            "properties": {
              "agent": ["water"],
              "subject": ["Some water damaged words"]

> But there is no "parent combinator" selector such that the following (also
> cumbersome) selector would work:
> span[itemprop=damage] < ?meta[itemprop=agent][content=water] {
> ? ?text-shadow: 2px 2px 16px #2b2b2b;
> }
> While admittedly, I perhaps should be directing my request to the CSS group,
> I still think it highlights the unnecessary burden of forcing the use of
> child elements when attributes are more reasonable.

Given the markup above, you can style this appropriately:

[itemprop=damage] > meta[itemprop=agent][content=water] + [itemprop=subject] {

Note, though, that Microdata or RDFa may not be quite appropriate for
this kind of thing.  You're not marking up data triples for later
extraction as independent data - you're doing in-band annotations of
the document itself.  As such, a different mechanism may be more
appropriate, such as your original design of using a custom markup
language in XML, or using custom attributes in HTML.  There's no
particular reason for these sorts of things to be readable by
arbitrary robots; it's sufficient to design for ones that know exactly
what they're reading and looking for.

Received on Sunday, 12 June 2011 23:41:09 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:06 UTC