Following a comment from ziggy on my previous entry, I feel I need to clarify.
The CSS::SAC filter that outputs an XHTMLified CSS file is just a pretty-printer. It was contributed by Steffen Goeldner and I want to run over it to see if it can be more featureful, ask his permission, and include it in the dist (and prolly fully SAX2ify it in the process).
What I find cool about it is not what it actually achieves (though I do like it much). It's more the SAC -> SAX approach. Call me a sad sad geek, but piping two very cool APIs together is something I consider cool :-)
Now, as for something that would either 1) take a single CSS stylesheet and produce the matching XSLT + FO sheet, it is possible (though you'll lose a few CSS Selector features that are not and will never be supported by XPath) but not totally trivial (I'd love to see someone do that though); or 2) take a CSS stylesheet and an XML file (which I think is what ziggy was pointing to) and produce the corresponding XSL FO document, yes that would be awesome as well. And it wouldn't be too complex either, because we already have some prior art in writing selector code. What's holding this project up presently is -- apart from the continuing 24h restriction on circadian cycles -- the wait for PerlDOM to be completed.
In other words, I'd like to implement that as:
That, imho, is the cleanest way of doing it. Surprisingly enough, it probably also is the simplest, if only because we already have most of the bricks.
Now, if you're not an XML frood and you've been reading this far (which says something about your courage and/or sanity I guess), or even if you are an XML frood, you're probably wondering what the point of all this is... Well, XSL FO isn't really the most human friendly syntax out there. In fact, it's painful enough that it is the reason why XSLT was invented. However, it is probably the best way to produce PDF, and other such formats (such as postscript) from XML (which makes it the easiest way to produce those formats programmatically). CSS, on the other hand, is really trivial to write. So XML + CSS = PDF would imho be a real winner.