XSLT and CSS
1. | Differences between CSS and XSL. |
Didier says: I am writing something on this but recently the OpenJade project took me a lot of energy. Anyway, before the document is published, I'll try to explain as objectively the state of the art. a) CSS: Actually supported by at least three browsers: a) Opera, b) Mozilla c)Internet Explorer. However, actually, only Internet Explorer support CSS for XML. This last fact is not well known. Because of intensive marketing effort about XSL from W3C members, it is not well known that CSS could be used for XML rendition (this is not a critic, and I am not saying it is bad. I am just stating the facts and takes consideration of XML/CSS vs XML/XSL publications). The next Mozilla release will also include XML rendition with CSS. I don't know for Opera and Hakon can probably tell us more on this topic. So, in a near future, the only cross browser rendition language will be CSS. b) XSL: Internet Explorer is the only major browser supporting XSL. The XSL supported is not the most up to date but to Microsoft discharge, XSL specs are evolving not necessarily at the same pace as the browser. We have to remember that XSL is still under definition and CSS is already a recommendation (CSS1 in 1996). A plethora of XSLT engines are available (mostly implemented in Java) for XML to HTML, XML to PDF transformation. However, these tools are not included in browsers. These are tools to be used stand alone or at server side. Basically in the current state of the art: CSS is now and for the near future, the rendition language of choice for client side rendition (at least if you want your XML document to be rendered in both Mozilla, Opera and Internet Explorer)- Con: a lot of borwsers do not yet support XML. XSLT is better now and in the near future for server side transformation - Pro: every browser support HTML. An important factor to take into notice: It takes time for the actual browsers to be replaced by new ones. For instance, there is still a majority of Internet Explorer v 4 in the market. Not everybody upgraded to version 5. Most of Mozilla browsers do not yet support XML, they support only HTML. Thus, actually, if a document is published in HTML format, it has a higher probability to be rendered everywhere than it is the case for a XML document (only a few can render it). If you choose to publish your document to be seen by the largest number of people (and therefore interpretable by the largest number of browsers), it is more clever to publish the document in HTML format. If the original document is stored in XML format, then any good XSLT engine used server side (preferably as a servlet) will do the job. Conclusion: If you want mass diffusion of your XML documents, it is preferable to use a XSLT engine located on the HTTP server (as a servlet because most of them are Java based) and have this engine transform your XML documents into HTML to be rendered on as much browsers as possible. Client side transformation is still experimental except if your target audience is using Internet Explorer V5 and none are using other browsers like Mozilla, Opera and others. Thus, the choice is not as much dictated by technical virtues as it is dictated by common sense and document diffusion strategies. Carsten Pfeiffer tells us: Konqueror, a browser running on all major Unices also supports CSS1 (pretty much completely) and CSS2 partially. It supports XML with CSS and work is in progress to support XSLT. Yes, konqueror It's the browser/filemanager/shell... from the K Desktop Environment. It's not using Mozilla or Gecko technology, it's all homebrew it runs on Linux, Solaris, *BSD and supposedly on AIX, HP/UX, Irix and Unixware (I don't have any of those boxen, so I can't test that). Additionally, there is Konq/e (Konqueror Embedded), that is a stripped down version running on the Linux Framebuffer device (-> running on the HP Journada, Palm/Handspring and every other device running Linux). It still supports SSL, Javascript and all that :) Regarding Windows: the toolkit that KDE (and Konqueror) uses is Qt (www.trolltech.com). It is available for Unix, Windows and soon MacOS X (and the Unix-Version has been ported to BeOS, too). However, only the Unix version is "free", so up to now, nobody has been working on a Windows port of Konqueror. | |
2. | FO to HTML and CSS |
we have just published a stylesheet that converts XSL FO to HTML+CSS1. It is a proof-of-concept thing; its main purpose is to enable browsing the content of an XSL FO document with a regular browser, it doesn't care about subtle formatting niceties. (The last MSXML3 preview release lacks quite a few to support this stylesheet; hopefully, the next one will permit us to ascribe the stylesheet to FO documents, thus enabling their direct viewing in MS IE5). Naturally, we have conceived this stylesheet as an add-on to our main product, XEP; therefore, the stylesheet supports the same obsolete version of XSL FO draft as XEP (and FOP) does. (I know Sebastian will blame me... ;-)) Upgrading it to the last draft is however not a difficult task; I will do it when we release the next version of XEP, unless someone does it before (any volunteers?). The thing is located at RenderX. Please visit and enjoy. |