Browsing XSL FO
Total Page:16
File Type:pdf, Size:1020Kb
DEVELOPER'S ZONE SHOP SEARCH Products Demos Stories Solutions Support Download Customers Partners Company Sitemap Browsing XSL FO XSL Formatting Objects are an XML dialect; why not render them to HTML by an XSLT stylesheet? What you see below is the first attempt to materialize this idea. It is created and maintained by RenderX development team as an add-on to our principal product, XEP. Introduction Here is the stylesheet: fo2html.xsl. Please download it and try to view your favorite XSL FO documents in a browser. Don't expect the result to be perfect - see below about limitations, but - look at our demos! If you plan to extend it to cover more of the XSL spec, please share your accomplishments with us. Here are some examples produced by the stylesheet from FO files. PDFs (generated by XEP) are also given; they serve as a reference to assess the quality of their HTML counterparts. All examples have been tested in IE5: for reasons explained below, we cannot guarantee full interoperability with other browsers. Description XSL FO HTML PDF (reference) Hammer Manual hammer.fo hammer.fo.html hammer.pdf XML 1.0 Recommendation xml2e.fo xml2e.fo.html xml2e.pdf XPath 1.0 Recommendation xpath.fo xpath.fo.html xpath.pdf Possible Use A stylesheet like this may be used to reduce the complexity in a publishing system with multiple target media: you generate XSL FOs from semantic XML data, and use it as a source for all other presentation formats. When your data structure changes, you only have to modify XML-to-XSLFO stylesheet. Technical Notes The stylesheet tries to convert XSL FO data into HTML+CSS1. CSS2 support is still rare among browsers, and hardly can be relyed upon. Even with CSS1, there are many discrepancies between MS Internet Explorer and Netscape Communicator. However, one can hardly do this task without using any stylesheet capabilities at all; so CSS1 seemed to be a common denominator. It goes without saying that XSL FOs are much more powerful than HTML+CSS1; moreover, since paged media are organized differently from scrollable media, absolute similarity is not achievable. Therefore, the conversion aims mostly at giving the user a possibility to browse FO files, without pretending to preserve all formatting subtleties predisposed for quality printing. The task is also simplified by common vocabulary shared by XSL FO and CSS.With this premises, the problem can be solved by amazingly simple means: a 30 kb stylesheet does the bulk of the work. Certainly, not everything can be achieved easily: for instance, calculating the inheritance propagation along the FO tree is a really tough task, as well as parsing CSS2 shorthands in XSLT. We didn't even attempted to tackle this: in our opinion, this is more easily achieved by a preprocessor. RenderX has such a preprocessor built into XEP; redirecting its output into a file gives us a "canonical" XSL FO document - with all shorthands expanded, inheritance propagated, length units normalized etc. However, if your XSL FO documents don't make use of shorthands, multiple columns, absolutely positioned blocks and similar advanced features, the results of the conversion can be very close to the truth even without preprocessing, like in the examples given above. This requires special care while writing XSL FO stylesheets; but our experience shows it is relatively easy. Products | Demos | Stories | Solutions | Support | Download | Customers | Partners | Company | Sitemap Copyright © 2001-2007 RenderX, Inc. All rights reserved..