XML News from Friday, January 12, 2007

The W3C Device Independence Working Group has posted a working draft of Content Selection Primer 1.0. According to the draft,

there are capabilities in other W3C and IETF specifications that allow some level of control over the particular variant of a resource that is returned to a browser in response to a request. While these capabilities can support many of the use cases commonly found on the conventional Web, practical experience has found them somewhat lacking for supporting selection of material to be used to support the myriad of different kinds of device that are now able to access the Web.

We've already noted issues with existing mechanisms where two different devices both support the same media type, but have other requirements. For example consider images encoded using the Portable Network Graphics [PNG] specification being delivered to one device that is a tiny mobile phone, and another, which is a large, personal digital assistant with a large screen. Suppose that an author is required to provide different versions of a particular image in order to satisfy design criteria for a page that must be delivered to both devices. Different variants of the image are prepared to satisfy the criteria. However, because both devices support the same image encoding, PNG, content negotiation cannot be used to provide the appropriate version in this case. The criteria used in content negotiation are simply not sufficiently fine-grained to cater for even this simple level of selection.

Solutions that support a wide variety of different types of device require the ability to make use of a wider range of different alternative content variants, and employ a much richer set of criteria in connection with selection.

Here's an example from the primer:

<sel:select>
       <sel:when expr="eg:getStyleSheetSupport() = 'excellent'">
          <link rel="stylesheet" type="text/css" href="../styles/sensational.css"/>
       </sel:when>
       <sel:when expr="eg:getStyleSheetSupport() = 'basic'">
          <link rel="stylesheet" type="text/css" href="../styles/mediocre.css"/>

       </sel:when>
   </sel:select>

The basic idea is that markup inline in the document will indicate the device classes for which given content is appropriate. Such hints may be necessary and useful, but I'm still skeptical that it really has to be inline. I don't see why it couldn't be part of some kind of external style sheet, much as CSS rules can be attached through external style sheets. I still think this mixes markup and presentation.