We opensourced our attempt at CSS generation in a java environment.
The website is a little outdated http://dynamic-style-sheets.org/dss-website/index.jsp but might give a rough overview. The SVN is more up-to-date ( http://opensaga.org/svn/opensaga-dynamic-stylesheets/trunk/ )
In addition to rule nesting and mixings, variables, expressions, etc, DSS allows user-defined functions to be written. Some come with it, including a system do imagemagick or so like processing of images in the CSS.
It's a funny little thing that kind of just wanted to be written that way.