RE: [xsl] Dynamic stylesheet selection

Subject: RE: [xsl] Dynamic stylesheet selection
From: Peter.FLYNN@xxxxxxxxxxxx
Date: Wed, 4 Apr 2001 15:27:03 +0100
If you were developing a servlet, you could check the User-Agent and
User-Accept values for the browser.  The eMobile example (part 1 and 2) on
java.sun.com is a good example that takes you through Servlets, XML and XSL.

In your servlet code, basically just have:

String userAgent = request.getHeader("User-Agent");
String userAccept = request.getHeader("Accept");

The User-Agent contains the browser type (e.g. Mozilla/4.51) 
The Accept value will contain many values about what document types the
browser can accept, for HTML based browsers one of the values will be
text/html.

WAP browsers generally have text/wml.

You can then check what documents your browser can accept, and modify the
java code accordingly to use the correct XSL stylesheet.

Regards,
Peter Flynn


***********************************************************************

Check us out at http://www.syntegra.com

***********************************************************************

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread