Browser Support of XSLT

 
xslt for dummies
Chapter 10 - To HTML and Beyond!
XSLT For Dummies
by Richard Wagner
Hungry Minds 2002
  

If you plan to convert your XML documents to HTML so that people can view your information with a Web browser, you have a decision to make: Where are you going to perform the transformation? You have three basic options:

  • Offline transformation: If your transformation is a one-time or infrequent event, you can do a batch process of transforming your XML documents to HTML. The advantage to this option is that it enables you to do transformations before the result documents are ever accessed. You can then put the output HTML files in the appropriate location when done, and any Web browser can display the output. If your information changes constantly, the disadvantage is that the processing is not done in real time, so the HTML documents may show stale information.

  • Server-side transformation: If you need to have up-to-the-minute transformations when a user requests the Web page, you can perform the transformation when the user requests the XML file. The document can then be transformed on the server, and the resulting HTML is sent to the Web browser so that the user can view the document.

  • Client-side transformation: A third option is to have the Web browser on the client do the transformations on the fly. In this case, a user receives an XML document from the server with a link to a stylesheet. The browser then performs the transformation, rendering the results in the Web browser as HTML. The advantage to this option is that it enables you to focus only the XML data and the XSLT stylesheet, and letting the browser concern itself with the transformation. However, the caveat is that the Web browser must support XSLT or else the transformation never happens.

If all Web browsers supported XSLT, then letting the transformation occur on the client would be a legitimate option. Take, for example, Internet Explorer 5.0 or higher. You can open up the preceding quoteslink.xml in Internet Explorer, and voil !the result document is a formatted Web page in full living color ! So if you know all your users have an XSLT-capable browser, you can create an entire XML-based Web site and have Internet Explorer transform each page on the fly.

Yes, this idea rocks, but unfortunately you cant always count on all Web browsers to support XSLT. In fact, most dont. Microsoft Internet Explorer 5.0 and higher support XSLT 1.0, as does Netscape Navigator 6.1 and higher. But even these two browsers have some peculiarities and differences in how they display transformed XML documents. However, given XSLTs popularity, you will start to see more standardized and consistent support for XSLT within the major browsers.

 Tip   The client-side transformation option can be an ideal solution within an office environment in which you can count on everyone using the same browser. Therefore, if an office is standardized on Internet Explorer 6.0 or higher, XML documents and XSLT stylesheets could be used in place of HTML files and get consistent results.

 Tip   XSL transformations are usually best performed on the server rather than relying on the browser to do it for you. With a server-side solution, you do not need to concern yourself with browser compatibility issues, because youre sending vanilla HTML to it. Also, depending on the files involved, server-based transformation can be more efficient with respect to bandwidth, since you only need to send one HTML document to the browser rather than both XML and XSLT documents. (On the other hand, if your document has a lot of repetitive sections of HTML being created, the client-side loading could be significantly more efficient.) Additionally, if you want to reduce the load on the server, then pushing the transformation to the client browser may be a sound option, apart from the browser support nonsense .

For the latest on browser support, check out the XMLSoftwares Browser page at www.xmlsoftware.com/browsers .

  
 
 
2000-2002    Feedback


XSLT For Dummies
XSLT for Dummies
ISBN: 0764536516
EAN: 2147483647
Year: 2002
Pages: 148

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net