XSLT Cookbook, from O'Reilly. Chapter 8 XML to HTML | 3 | WebReference

XSLT Cookbook, from O'Reilly. Chapter 8 XML to HTML | 3

XSLT Cookbook
By Sal Mangano
www.oreilly.com/catalog/xsltckbk/?CMP=OT19179
O'Reilly & Associates, December 2002
ISBN: 0-596-00372-2

Chapter 8: XML to HTML

That was a surprise to me—that people were prepared to painstakingly write HTML.
-- Tim Berners-Lee

If I had to hazard a guess, I would say that at least 60% of the HTML delivered over the Internet today is at least partially generated. This is not because HTML is painstakingly hard to write, as Tim Berners-Lee states in the opening quotation (it is, but now we have fancy HTML editors), but because dynamically generated HTML allows you to do so much more.

There are many open and proprietary technologies for delivering HTML content from data stored in other forms. However, when the data is in XML, XSLT is one of the most important tools of which web authors should be aware.

You can use XSLT to generate HTML in three basic ways.

First, XSLT can transform XML into HTML and statically store the generated HTML on a web server or hard drive for delivery to a browser. This is also a good way to test such transformations.

Second, you can use XSLT as a server-side scripting solution in which XML extracted from flat files or databases is dynamically transformed by the web server as requested by the client browser. This solution is necessary when the underlying data changes frequently. However, sometimes a hybrid solution is used in which HTML is constructed on demand, but then cached on the server to avoid the need for subsequent transformations as long as the underlying data does not change.

Third, you can use XSLT as a client-side stylesheet, provided the browser supports XSLT processing. At this time, only the latest versions of Microsoft Internet Explorer (Version 6.0) and Netscape Navigator (6.1) have support for XSLT right out of the box. Older versions of IE require installation of MSXML 3.0 in replacement mode. In addition, XSmiles and the Antenna House XSL Formatter perform client-side XSLT processing and display the result. X-Smiles can handle all sorts of results, including SVG and XSL-FO, although the HTML handling is not perfect. The Antenna House XSL Formatter handles XSL-FO. As the state of the world changes rapidly in this area, you should check the latest online documentation of your favorite browser or browser add-in.


Created: March 27, 2003
Revised: May 5, 2003

URL: http://webreference.com/programming/xslt/cookbook/chap8/1