CSS and Xforms
There was a question on Mark Birbeck’s mind. Should Xpath feature CSS? “But while some sort of convergence of XPath and CSS selectors may seem an obvious thought to many, the CSS ‘language’ continues to resist being brought up to date, and instead exists in a strange, murky world, of ‘quirkarounds’ and ’standards-proprietary’ syntax. (As people require the ability to address other parts of the source tree, new selection mechanisms have to be added, but in a way that doesn’t affect existing rules — resulting in ‘quirky workarounds’, and syntax that is not shared by any other standard.)
Before we look at whether XPath fits with CSS, it’s worth looking at what exactly it is that CSS does. It may seem obvious — surely it just provides styling information based on a set of rules? — but if you break it down a bit you’ll find that the general mechanism at play could be used in many other situations. To understand CSS we need to look at its processing model and its addressing model.
The CSS Processing Model
The CSS processing model [2] says that in effect all properties that are supported by the current media type should be added to each element in the DOM tree (see step 4, in the processing model). This means that if our document were to be rendered on a screen, each element in our DOM tree would gain a color property (amongst others), since color is one of the many properties available when the media type is screen.
Let’s assume that this property is actually implemented as an attribute on the element itself, and let’s also prefix it with a namespace for CSS, so that it doesn’t get mixed up with other color attributes that we might have. ”
Read the full article at the author’s personal blog.