Hi Dave,

Actually, StyleChooser::UA will not really do what you want. You need a
plugin that crams the user-agent string into a request param (so it acts
like POSTed form data or a querystring param, which are available to the
stylesheets via <xsl:param> elements). 

I have one that I use here to pass the request URI using the same
method:

----------%<--------------------------------
package Apache::AxKit::Plugin::URIasParam;

use strict;
use Apache::Constants;
use Apache::Request;

sub handler {
    my $r = shift;
    my $uri = $r->uri;
    my $cgi = Apache::Request->instance($r);
    $cgi->parms->set('_axkit-uri' => $uri);
    return OK;
}

1;
----------%<--------------------------------
 
This makes the URI string available to my XSLT stylesheets via
<xsl:param name="_axkit_uri"/>, you could do the same for the UA string.

Now that i think about it... are the request/server/environment vars
something that folks will want, in general, to be available to their
stylesheets? If so, and I get enough "+1"s here, I'd be willing to ram
out and CPAN a Plugin that does all that stuff...

HTH,

-kip
"Dave Brooks, BCS Systems" wrote:
> 
> I'm starting to answer my own question:
> 
> Using something like Apache::AxKit::StyleChooser::UserAgent (as a plugin?)
> will extract the value of HTTP_USER_AGENT. Now how does one pass this value
> as a parameter to the stylesheet?
> 
> Dave
> 
> At 11:15 12/03/2002 +1300, Dave Brooks, BCS Systems wrote:
> >Hi,
> >
> >Is there a simple way of getting the value of HTTP_USER_AGENT (and other
> >CGI environment variables) as <xsl:param/> variables in a stylesheet?
> >
> >
> >Thanks,
> >
> >
> >Dave
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
print join ' ', map { ucfirst($_->getFirstChild->getData)}
XML::LibXML->new()->parse_string(join '', pack "c*", (60, 122, 62, 60,
97, 62, 106, 117, 115, 116, 60, 47, 97, 62, 60, 98, 62, 97, 110, 111,
116, 104, 101, 114, 60, 47, 98, 62, 60, 99, 62, 112, 101, 114, 108, 60,
47, 99, 62, 60, 100, 62, 88, 77, 76, 60, 47, 100, 62, 60, 101, 62, 104,
97, 99, 107, 101, 114, 60, 47, 101, 62, 60, 47, 122,
62))->findnodes('//*[name() != "z"]')->get_nodelist;

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to