cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Edwards <>
Subject Re: is there a BrowserAction?
Date Fri, 17 Feb 2006 00:40:41 GMT
Hi Stephen,
You can use a selector and pass a parameter into the tranform:
        <!-- Main rendering matcher -->
        <map:resource name="html">
            <!--map:transform src="xsl/pifnamespaces.xsl"/>-->
            <map:select type="browser">          
                <map:when test="explorer">
                    <map:transform src="xsl/site2xhtml.xsl">
                        <map:parameter name="browser" value="explorer" />
                        <map:parameter name="version_num" 
                <map:when test="netscape">               
                    <map:transform src="xsl/site2xhtml.xsl">
                        <map:parameter name="browser" value="netscape" />
                        <map:parameter name="version_num" 

                <map:when test="opera">               
                    <map:transform src="xsl/site2xhtml.xsl">            
                        <map:parameter name="browser" value="netscape" />
                        <map:parameter name="version_num" 

                    <map:transform src="xsl/site2xhtmlPIE.xsl">
                        <map:parameter name="browser" value="Pocket 
Explorer" />
                        <map:parameter name="version_num" 

In your xsl just 'declare' a browser parameter and use it to vary the 
html etc, eg:

        <xsl:if test="$browser = 'explorer'">
            <script type="text/javascript" src="fixed.js"></script>
            <script type="text/javascript">

Hope this helps.


Stephen Winnall wrote:
> I am looking for a way to get information about the user's browser in 
> a transformation in a
> Cocoon pipeline. I may be looking for the wrong thing, or trying to go 
> about it in the wrong
> way, so I'd be grateful for any advice.
> I want to handle browser differences in an XSLT file rather than in 
> the sitemap. I realise that
> I could use BrowserSelector if I wanted the logic to be in the 
> sitemap, but I think I have a
> cleaner  solution if I can put the logic into a transformation. An 
> action  along the lines of
> LocaleAction would seem to me to fit the bill.
> I've spent some time googling for BrowserAction and variations of 
> that, but I haven't found
> anything and suspect that I may have to write the thing myself. Does 
> such a thing already
> exist? Or is there already an elegant way of passing the name of the 
> browser (ideally with
> version and OS) to an XSLT in a pipeline?
> Steve
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Tony Edwards
Dip Teach PE  
Dip Comp. Studies
p: 02 4941 9400
f: 02 4941 9499


This email is from Civica Pty Limited and it, together with 
any attachments, is confidential to the intended recipient(s) 
and the contents may be legally privileged or contain 
proprietary and private information. It is intended solely 
for the person to whom it is addressed. If you are not an 
intended recipient, you may not review, copy or distribute 
this email. If received in error, please notify the sender 
and delete the message from your system immediately. Any 
views or opinions expressed in this email and any files 
transmitted with it are those of the author only and may 
not necessarily reflect the views of Civica and do not create 
any legally binding rights or obligations whatsoever. Unless 
otherwise pre-agreed by exchange of hard copy documents 
signed by duly authorised representatives, contracts may not 
be concluded on behalf of Civica by email. Please note that 
neither Civica nor the sender accepts any responsibility for 
any viruses and it is your responsibility to scan the email 
and the attachments (if any). All email received and sent by 
Civica may be monitored to protect the business interests of 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message