Approximate CSS Styling in XSLT
This paper discusses transforming a CSS stylesheet into an XSLT transform that projects an approximation of the styling from the CSS onto a target XML document. It was developed during several XSLT-based projects involving multi-dialect XML documents, where there was a need either to evaluate CSS properties for another external tool, such as in an HTML → XSL-FO → PDF pipeline, or where a document styling needed to be “fixed” for embedding in another document, such as examples in professional papers. The paper presents examples, explains the general architecture of the generated XSLT transform, discusses how that transform is itself constructed from the CSS stylesheet and outlines the strengths and weaknesses and some of the directions in which the tool could be developed. It is approximate in that it only supports some of the core CSS features, assumes the user is “skilled in the art” and is working with CSS stylesheets that are understood and visible, and that the execution speed of the CSS “projection” is not an issue. Nevertheless, in the author's experience the ability to mix CSS styling into the “XSLT researcher's toolbox” has proved to be of some utility.