Thanks for the info!
I took a look at your module and realized that I didn't really want to
parse the user agent string inside XSLT. Therefore, I used your code as
a catalyst for the following quick and dirty hack.
I include this here in case anyone else finds it useful. Sorry for the
lack of docs... like I said, it was a quick hack... :-)
n.b. It requires HTTP::BrowserDetect (available on CPAN)
Tim.
package Apache::AxKit::Plugin::BrowserDetect;
use strict;
use Apache::Constants;
use Apache::Request;
use HTTP::BrowserDetect;
use vars qw( $VERSION );
$VERSION = '1.00';
sub handler {
my $r = shift;
my $a = Apache::Request->instance($r);
my $bd = new HTTP::BrowserDetect;
my $vendor =
($bd->opera) ? 'OPERA' :
($bd->konqueror) ? 'KONQ' :
($bd->ie) ? 'MSIE' :
($bd->gecko) ? 'NS6' :
($bd->netscape) ? 'NS4' : 'OTHER';
my $platform =
($bd->unix) ? 'UNIX' :
($bd->windows) ? 'WINDOWS' :
($bd->mac) ? 'MAC' : 'OTHER';
$a->parms->set('browser.vendor', $vendor);
$a->parms->set('browser.platform', $platform);
$a->parms->set('browser.version', $bd->version);
$a->parms->set('browser.version.major', $bd->major);
$a->parms->set('browser.version.minor', $bd->minor);
return OK;
}
1;
__END__
On Mon, Apr 08, 2002 at 11:53:23AM -0400, Kip Hampton wrote:
>
> Hi Tim,
>
> What you seek is already implemented in
> AxKit-Plugin-AddXSLParams-Request[1]. One of these days, I'll get around
> to shoving it out to CPAN. See the docs for usage, if you have any
> questions or comments, please feel free.
>
> -kip
>
> [1]
> http://hampton.ws/download/files/Apache-AxKit-Plugin-AddXSLParams-Request-1.00.tar.gz
>
> Tim Peoples wrote:
> >
> > I currently have a snippet of code that parses the HTTP_USER_AGENT env
> > variable and sets a short attribute on the root element of my XML document
> > (this is done in Mason using Apache::Filter).
> >
> > I would much rather this be done by Apache itself and have it pass a
> > parameter to the toplevel stylesheet (where I can capture it with an
> > <xsl:param> element).
> >
> > Any pointers on how I might do something like this would be greatly
> > appriciated.
> >
> > Thanx,
> > Tim.
> >
>
--
__________________________________________________________________
\ \ Timothy E. Peoples
\ c o l l e c t i v e Engineering Manager
\ \ [EMAIL PROTECTED]
DTA - Death To Acronyms
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]