XSL Device Formatting Using the Microsoft XSL ISAPI Filter
The XSL ISAPI filter is an extension to Microsoft's Internet Information Services that simplifies the deployment of server-side XSL stylesheets. In this article Jean shows us how to download, configure and use the XSL ISAPI filter to generate output for different devices automatically from IIS, including web browsers and WAP compatible phones.
XSL Device Formatting Using the Microsoft XSL ISAPI Filter - Our sample application (Page 3 of 4 )
The following code example represents a small application that presents a list of numbers on a single page. Because both WML devices (WAP phones) and HTML devices (Web browsers) will use this application, we will need two stylesheets. In addition, we will also need the .pasp file that will generate the XML as well as a configuration file that will specify which stylesheet should be applied to which device.
The ASP source for generating the XML page (test.pasp) looks like this:
For each XML document, it's necessary to specify a configuration file that will determine the appropriate XSL stylesheet to use for any given device. The configuration file for our sample application is called test-Config.xml and is shown below:
<?xml version="1.0" ?>
<!-- for WML 1.1 browsers -->
<!-- for Others browsers -->
The target-markup attribute value of the device element in the code above must exist in the browscap.ini file. The XSL ISAPI filter uses the associated information as the Content-type for the requests output.
IIS will apply the associated stylesheet to the first matching device. In the above case, if the device accepts WML1.1, IIS will apply test-WML11.xsl -- otherwise it will apply test-IE5.xsl. For browsers like IE 5.5 that can process XSL on their own, developers can choose to leave the XML untouched. For such client-side XSL processing, the XML will be sent to the browser, which will use the specified stylesheet to format the document.
Here's the HTML XSL stylesheet, which is called test-IE5.xsl: