XSL has been mooted as the way to translate xml. However, XSL is a complex and as-yet-incomplete piece of work. If youve read the XSL spec, you may find yourself wondering whether things really need to be that complicated. Do You Need XSL? Although XSL is a simplification of DSSSL (the XSL spec is approx 30 pages, the DSSSL spec is several hundred pages!), it is still a complex piece of design, in part because it attempts to merge a number of pre-existing ideas (DSSSL, CSS) into a single style language. An XSL document defines a set of rules which can be used to identify structural patterns within an XML source document. These rules then define actions which in turn produce a sequence of flow objects which define the formatting intent for the document (e.g. which font? how much indent? what line spacing? etc). But were not there yet. These flow objects then have to be fed into some kind of formatting engine which generates an actual formatted document. The matching of rules to XML source constructs can be governed by patterns which may refer not only to particular tags within the source document but also to ancestors and descendants and attributes thereof. (The rules for rules are complicated to say the least, and one wonders how many of these clever ideas will ever be used in real world applications?) XSL also has notions of styles to accommodate the concepts inherited from CSS (Cascading Style Sheets) and a scripting language based on JavaScript, but renamed ECMAScript. XSL is complex because it tries to do a lot some people might say too much. A Simpler Alternative to XSL For many publishing requirements, a much simpler strategy can be used which merely translates XML markup into a tool-specific markup for a particular target medium. For the web, a translation from XML to HTML is sufficient. For print publishing a translation from XML to a markup language such as Frame Markup, PageMaker Markup or TEX macros will do the job. Such an approach is simpler than XSLs attempt to model document formatting in all its generality because it does a simple clearly defined job and leaves the details of formatting to existing tried and tested tools. Further Reading A lengthy critique of XSL by Michael Leventhal was published on the xml.com website in May 1999.
Website built using Frontier and xmltr. Documentation also available in pdf format for offline reading. Copyright The Design Group Qld 1999. This page last updated Thu, 2 Dec 1999 |