You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Richard Korthuis <R....@telecats.nl> on 2000/10/09 11:53:09 UTC

Detecting USER_AGENT using cocoon 1.8

Hello,

I would like to use different stylesheets (XSL) for different WAP-phones. I
know this is possible by looking at the HTTP_USER_AGENT string in the
HTTP-request.
My question is what should I add to cocoon.properties in order to be able to
associate different stylesheets with different phones?
I know the HTTP_USER_AGENT string from the Nokia 7110 is:
Nokia 7110/1.0 (xx.yy)		xx.yy=software version
The HTTP_USER_AGENT string from the Nokia 9110i Communicator is:
Nokia-Communicator-WWW-browser/3.0 (Geos 3.0 Nokia-9110)

Richard Korthuis
TeleCats BV

Re: Detecting USER_AGENT using cocoon 1.8

Posted by Marco Pauck <pa...@wmd.de>.
Richard Korthuis wrote:
> 
> I would like to use different stylesheets (XSL) for different WAP-phones. I
> know this is possible by looking at the HTTP_USER_AGENT string in the
> HTTP-request.
> My question is what should I add to cocoon.properties in order to be able to
> associate different stylesheets with different phones?
> I know the HTTP_USER_AGENT string from the Nokia 7110 is:
> Nokia 7110/1.0 (xx.yy)          xx.yy=software version
> The HTTP_USER_AGENT string from the Nokia 9110i Communicator is:
> Nokia-Communicator-WWW-browser/3.0 (Geos 3.0 Nokia-9110)

Well, I'm not going that far distinguishing different versions
of the Nokia browser but instead simply Nokia, Phone.com (UP),
generic WML and generic HTML.

But to give you the idea, these are the definitions in cocoon.properties:

browser.0 = explorer=MSIE
browser.1 = pocketexplorer=MSPIE
browser.2 = handweb=HandHTTP
browser.3 = avantgo=AvantGo
browser.4 = imode=DoCoMo
browser.5 = opera=Opera
browser.6 = lynx=Lynx
browser.7 = java=Java
browser.8 = nokia=Nokia
browser.9 = up=UP.Browser
browser.10 = wap=Wapalizer
browser.11 = wap=Wap
browser.12 = mozilla5=Netscape6/
browser.13 = netscape=Mozilla

And these are the declarations in the XSP pages:

<?xml-stylesheet href="generic-html.de.xsl" type="text/xsl"?>
<?xml-stylesheet href="generic-wml.de.xsl"  type="text/xsl" media="wap"?>
<?xml-stylesheet href="nokia-wml.de.xsl"    type="text/xsl" media="nokia"?>
<?xml-stylesheet href="up-wml.de.xsl"       type="text/xsl" media="up"?>

	Marco Pauck