Building an AjaxPro.NET Based Search Engine into Your Website - Introduction to Google AJAXSLT
(Page 3 of 4 )
Generally, there are two ways for us to render incoming XML on the browser. Previously, XSLT has been used as a server-side technology—the server grabs some XML and creates a web page by transforming it into XHTML. More recently, browsers have incorporated XSLT functionality, so that the browser can create an HTML page by marrying an XML document with an XSLT stylesheet.
Browser-side XSLT is slightly different from that of the server side. In this case, the XML document does not constitute the contents of the entire page, but a response from an XMLHttpRequest Call. The transformation to XHTML can take advantage of the browser's built-in XSLT support, or alternatively an XSLT processor can be implemented in JavaScript, building on the browser's more primitive XML features. However, due to the complexity of XML and XSLT transformation, many developers are unlikely to implement it by themselves. Fortunately, there are a couple of good cross-browser libraries available, one of which is Google’s AJAXSLT, which has already been put into use in developing the famous Google Maps.
Now, let’s say a few more words about AJAXSLT.
First of all, we can download it from here. AJAXSLT is an implementation of XSLT in JavaScript—a browser-side solution. Because XSLT uses XPath, it is also an implementation of XPath that can be used independently of XSLT. This implementation has at least two advantages: it makes XSLT uniformly available on more browsers than natively provide it, and it can be extended to more browsers when necessary.
AJAXSLT’s implementation of XSLT operates at the DOM level on its input documents. It internally uses a DOM implementation to create the output document, but usually returns the output document as a text stream. The DOM to construct the output document can be supplied by the application, or else an internal minimal DOM implementation is used. This DOM comes with a minimal XML parser that can be used to generate a suitable DOM representation of the input documents if they are present as text.
The most important thing you should notice is that this framework also supports the aforementioned two ways of rendering XML on the browser—the browser side and the server side. For more flexibility, in this sample we will leverage the second solution. The ".xslt" stylesheet is stored under some sub folder of the web site while the "real" XML content comes from the database. For more details, please click on the link below and keep reading.
Next: Database Design >>
More .NET Articles
More By Xianzhong Zhu