- From: Michael Day <mikeday@yeslogic.com>
- Date: Thu, 17 Apr 2003 21:29:12 +1000 (EST)
- To: www-style@w3.org
Hi, I would like to put forward the following (as yet ficititous) syntax on the subject of using stylesheets to assign semantics to unknown XML vocabularies for the purposes of styling. (This example can be seen to follow in the footsteps of the Opera extensions to CSS: link, link-source and replace). @semantics { title { role: title } a[href] { role: link; link: attr(href) } h1, h2, h3, h4, h5, h6 { role: heading } meta[name][content] { role: meta-data; meta-name: attr(name); meta-value: attr(content) } } And now a justification for the various ideas above. Firstly, it is worth separating the new semantic properties from the existing style properties by means of a @semantics section, to simplify implementation, particularly the resolving of links in time to use the :link pseudo-class. The "role" property does for semantics what the "display" property does for style. "role: title" is useful for styling; how else do you know the title of the document, to use as a filename, or use as the title of a window, or place in the metadata describing a PDF and so on. "role: link" or some variant is obviously necessary for applying the :link pseudo-class to unknown vocabularies. "role: heading" is useful for generating outlines and tables of contents. However this is probably the weakest part of this proposal, as it gives no way to specify the different levels of heading, and it feels that the existing CSS counter mechanism would be useful for that. "role: meta-data" is also useful for styling, paradoxically enough. Note that this could also replace "role: title", if a more general solution is desired. For example: title { role: meta-data; meta-name: title; meta-value: auto; /* content of element by default */ } Now for a complete change of direction: it would be possible to achieve this outcome in an entirely different way, by extending the "display" property and combining with some alternative language. For example: title { display: window-title; } or: title { display: meta-data; meta-name: "Title" } However, this feels much less convenient than simply telling the processor what it is, and letting it deal with it in the most appropriate way. After all, "window-title" will make sense to a browser, but not a printer, or an aural browser. And having to drag in additional languages such as HLink, RDF or XLink2 seems like overkill just to make :link work. I hope that this proposal leads to some discussion, and trust that using the word "semantics" so heavily in this way in a language devoted to style will not cause too much flaming :) Michael Day YesLogic Pty. Ltd.
Received on Thursday, 17 April 2003 06:13:05 UTC