Archived at Pineapplesoft
 ananas.org 
  The Pineapplesoft Link newsletter covered a wide range of technical topics, see the archived issues.
The newsletter was first emailed in 1998. In 2001 Benoît discontinued it in favour of professional writing for magazines.
The “Some Thoughts on XSL, May 2000” page was archived in 2003 to preserve the original content of September 2000.
 
  | Home | Contact | Site map | Writings | Open source software |  


 

Welcome to the 29th issue of Pineapplesoft Link. In May, I revisit XSL, the XML Stylesheet language.

Some Thoughts on XSL

XSL is the XML Stylesheet Language, one of the numerous standards published by the W3C to support XML. I consider XSL one of major XML standards, along with namespaces and SAX. I rate XSL as major because almost every XML application will need it.

I did a fair amount of XSL work last month: the new XML book, which I am currently writing, explores several advanced XSL techniques. I also gave a customized XSL training for a local company. Finally, I still receive many comments following the "XML Programming for Teams" article I published in last September (http://developer.iplanet.com/viewsource/marchal_xml.htm).

Last but not least, there are almost daily XSL-related announcements: new XSL processors, new formatters and, at long last, XSLFO is close to being final. One of the funniest XSL announcement last month came from Don Box which wrote a SOAP endpoint in XSL!

Crash Course on XSL

The naming "stylesheet" is very unfortunate. In most cases, a style sheet is a tool to format and publish documents, e.g. Cascading Style Sheet or Word style sheets (now called templates). Not quite with XSL or, to be more correct, XSL is 10% formatting and 90% non-formatting!

There are two main aspects in XSL. Firstly XSLT and XPath define a transformation language (the T in XSLT stands for transformation). In other words, it's a tool to take an XML document and transform it in another XML document (although HTML and text are also supported).

Secondly XSLFO (XSL Formatting Objects) is a language to describe mainly printed documents. This part of XSL is what you would expect in a style sheet, it's all about choosing font, boldness and page jumps. However, unlike XSLT and XPath, it's not a standard yet (but soon will be).

Not Only for Publishing...

Currently, most applications of XSL center on XSLT, the transformation part. And they mainly use XSLT to convert XML documents to HTML for web publishing.

For example, you will recall that I use XSLT to publish this newsletter (http://www.psol.be/old/1/19990801_xml.html): I write the newsletter in XML and I have two style sheets to automatically generate the email and web page.

I regularly hear from readers on this topic. It seems many are confused and see XSL as a sort of CSS. I often receive emails of the form "XML looks good but I need to use [plug your favorite feature here] and I'm concerned XSL won't support it". The favorite feature can be anything but it tends to be JavaScript, DHTML, CSS, plug-ins and   -- non-breakable spaces.

In fact, there is no built-in limits to what you can do with XSL. Bear in mind the style sheet creates a brand new HTML document. This document can include any HTML tag, including browser-specific tags like <MARQUEE>. And, yes, it can include CSS, scripts, &nbsp;, tables or just about anything else!

... but Also for Data

Although XML is real good for web publishing (after all, that's what it was designed for), its most useful applications are in data exchange and e-commerce. In data exchange, web sites zap files to each other. What files? Anything: a price list, a bank statement, the latest news, a tax declaration or an order.

Yes but what about style sheets? Obviously this is not a formatting issue. Absolutely but remember XSL is mainly a transformation solution and there is a lot of transformation taking place in data exchange.

Let's follow the trail of an order, as an illustration. Let's concentrate on the paper order first, the non electronic version. The first step is probably to fill an internal form to request a budget for the expense. When it is returned, signed, the employee can fill the supplier order form.

Now wait! What this order form? How does it differ from the internal form? The truth is they share the same information but in a different format (I almost wrote presentation). They are different because they serve different purposes but the underlying information is common. For example, the vague product description on the budget form (a laptop) becomes a precise product reference (this model with these options).

After shipping the goods (hopefully), the supplier issues an invoice. How does the invoice differ from the order form? Again, it serves a different purpose but it's the same underlying information: the goods and their price.

The electronic version of these documents undergo the same transformations... and then there some more. With XML, different organizations may use different vocabulary, think of it as different forms. That means more transformation.

XSL is the tool of choice for these transformations: not only is it powerful but it is also supported by a standard, meaning there is no shortage of tools to choose from.

Where to Now?

Clearly, XSL is an important tool to learn today for web publishing. However XSL is slowly moving out of publishing and into the data area. This move makes it even more important to learn XSL: you'll learn both techniques at once!

Self-Promotion Department

"XML by Example" is still going strong. If you want to comment on the book, drop me an email.

In May, I'm hosting one training session in Paris (16 May 2000, http://www.technoforum.fr). Hope to see you there!

About Pineapplesoft Link

Pineapplesoft Link is a free email magazine. Each month, it discusses technologies, trends and facts of interest to web developers.

The information and design of this issue of Pineapplesoft Link are owned by Benoit Marchal and Pineapplesoft. Permission to copy or forward it is hereby granted provided it is prefaced with the words: "As appeared in Pineapplesoft Link - http://www.pineapplesoft.com."

Editor: Benoit Marchal
Publisher: Pineapplesoft www.psol.be

Acknowledgments: thanks to Sean McLoughlin MBA for helping me with this issue.

Back issues are available at http://www.psol.be/old/1/newsletter/.

Although the editor and the publisher have used reasonable endeavors to ensure accuracy of the contents, they assume no responsibility for any error or omission that may appear in the document.

Last update: September 2000.
© 2000, Benoît Marchal. All rights reserved.
Design, XSL coding & photo: PineappleSoft OnLine.