Robert C. Leif wrote:
Presently XML documents can be formatted by either cascading style
sheets, CSS, or XSL FO. When I have an application that outputs a CSS, I
would like to convert the CSS to an XSL style sheet. This would permit
upgrading a large number of legacy documents.

XSL FO is an XML vocabulary for expressing formatted content. An XSL style sheet usually refers to a description of a transformation of some XML into something else, perhaps into an XSL FO document.

Writing a converter from CSS into an XSL style sheet should
not be all that difficult as long as the @media stuff and the
more awkward pseudo properties can be ignored. The CSS
classes would be transformed into templates, roughly
 element.class { property: value; }
into
 <xsl:template match="element[class='class']">
   <xsl:copy>
     <xsl:attribute name="property">value</xsl:attribute>
     <xsl:apply-templates select="node()|@*/>
   </xsl:copy>
 </xsl:template>

The biggest problem appears to be to implement a proper
parser for the CSS syntax.

Such a CSS converter is probably part of the various HTML->FO
converters, check the AntennaHouse converter for ideas. You
can also ask again on the XSL list, perhaps one of the gurus
there has heard of an efford to build the converter you desire.

Failing this all, you are invited to write one yourself.

J.Pietschmann



Reply via email to