Getting Started with Ajax
June 23, 2005
Part 3: Using XSLT to Transform the XML on the Client
In the previous section, we built an application to dynamically retrieve pages of data for
a specific table. As mentioned above, the method of transforming the XML into an HTML
In this part of the article, we will use XSLT to transform the response XML. This will simplify the client side Javascript and enable reuse of the transformed style. W3Schools has an excellent tutorial on XSL and XSLT if you are new to the technology. Basically, XSLT is a language used to transform an XML document into another XML document, including XHTML, by applying an XSL (XML stylesheet) to the XML.
<table> was very specific to the table being built. The layout and style
of the constructed HTML was specified in the Javascript and would be difficult to reuse in
other areas of the application.
In this part of the article, we will use XSLT to transform the response XML. This will simplify the client side Javascript and enable reuse of the transformed style. W3Schools has an excellent tutorial on XSL and XSLT if you are new to the technology. Basically, XSLT is a language used to transform an XML document into another XML document, including XHTML, by applying an XSL (XML stylesheet) to the XML.
Browser Support for XSLT
Fortunately, current versions of most leading browsers (excluding Opera 8) have support
for XSL and XSLT. Therefore, the XML to XHTML transformation can be performed on the client
computer without downloading any extra software. Unfortunately, these browsers have
slightly different objects for XSLT support. Therefore, developers must again write
redundant code to support multiple platforms.

