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 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

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.

Peter Flynn


Check us out at


 XSL-List info and archive:

Current Thread