cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Tibbetts" <Alan.Tibbe...@zishi.net>
Subject RE: Applying diferente stylesheets to diferent wap browsers
Date Thu, 22 Mar 2001 14:42:31 GMT
:>here are 3 lines from cocoon.properties:
:>
:>browser.8 = wap=Nokia
:>browser.9 = wap=UP
:>browser.10 = wap=Wapalizer
:>
:>the last word in the line is the name which the browser identify.
:>the word before is that what you can type in the "media"-attribute.
:>So you can differentiate this with "wapNokia", "wapUP", and so on.

We have taken a slightly different approach.  In order to separate the
stylesheets for
the different mobile devices (mainly for configuration management reasons),
we have a directory called 'xsl' in our web context and under that we have
one directory for each device: Nokia7110, MotorolaP7389, etc.  These names
correspond to the user-agent in the Http Header
(request.getHeader("User-Agent")).

In our xml sheets (which are obviously XSPs) we dynamically assign
stylesheet references based on the user-agent:

<xsp:logic>
	String stylesheet = (String) session.getAttribute("XSL");
</xsp:logic>

<xsp:pi target="xml-stylesheet">
	  href="<xsp:expr>stylesheet</xsp:expr>"
	  type="text/xsl"
</xsp:pi>

The attribute 'XSL' is created previously by a JSP Tag that combines the
required stylesheet with the location of that stylesheet, based on the
user-agent, e.g. where the xml page requires the stylesheet: menu.xsl for a
Nokia7110, the generated reference would be:
http://www.zishi.net/zishi/xsl/Nokia7110/menu.xsl.

---

Alan Tibbetts
Developer
Zishi Ltd

Tel: +44 (0) 20 7262 5566 (ext 291)

Fax: +44 (0) 20 7262 6389
Mob: +44 (0) 7989 434 790

www.zishi.net


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message