XSL ISAPI Filter 2.0

Tim Huckaby introduces you to the new XSL Internet Server API Filter and outlines its features.

Tim Huckaby

October 9, 2000

2 Min Read
ITPro Today logo

In this "Tips and Tricks," I'd like to talk about a great piece of code I found at the Microsoft Developer Network (MSDN) Online Code Center that is handy and production ready—XSL ISAPI Filter 2.0. XSL ISAPI Filter 2.0 performs server-side Extensible Style Language (XSL) formatting for multiple devices. It automatically executes XSL style sheets on the server based on browser type. The filter also has features, such as style-sheet caching, for improved performance and customizable error messaging.

An Internet Server API (ISAPI) filter is a DLL that loads into the IIS process when you start the Web Service. The filter stays in memory until you shut down the Web Service. Once loaded, ISAPI filters are configured to receive a number of special filter event notifications that occur with each HTTP request that IIS receives and each response that IIS generates in return. In this case, when IIS receives an HTTP request for XML data, the ISAPI filter automatically formats the data with an appropriate style sheet for the device that has to render it.

A plethora of new Internet-enabled devices exist—cellular phones, handheld devices, televisions, and game consoles to name a few. What makes this environment even more complex for Web developers is that different devices within the same form factor often have different markup languages that they interpret. Historically, this variation has made life miserable for developers trying to code a suitable UI for each device. XSL can filter and transform XML for presentation, but not all browsers support XSL. In addition, writing code to choose style sheets based on browser device characteristics and then executing those style sheets on the server is difficult, which explains the need for XSL ISAPI Filter 2.0.

This filter really is .NET before its time. Web developers don't have to worry about the form factor or capabilities of the devices that touch their code: The OS handles the proper rendering for them. (In this case, IIS with the help of XSL ISAPI Filter 2.0 handles it.) Here's a summarized feature list of XSL ISAPI Filter 2.0:

  • Automatic execution of XSL style sheets on the server; choosing alternative style sheets based on browser device characteristics or XML document type

  • Pipelining of Active Server Pages (ASP)-generated XML into XSL style sheets

  • Style sheet caching for improved server performance (includes caching of precompiled style sheets through the XSLTemplate object on systems with this object installed)

  • Chaining execution of multiple style sheets

  • Multiple, configurable output MIME types

  • Postprocessing support for the following cellular phone markup languages: Handheld Device Markup Language (HDML), Wireless Markup Language (WML) 1.0, and WML 1.1

  • Ability to specify output encodings and character sets

  • Device-customizable error messages

  • Configurable pass-through of the XML for subsequent client-side XSL processing

To find the XSL ISAPI Filter 2.0 DLL, source code, and detailed documentation, visit the Code Center. In the left navigation pane, click Sample Applications, then click XSL ISAPI Filter 2.0.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like