You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Richard Cunliffe <ri...@cunliffe.net> on 2003/02/01 01:21:27 UTC

Browser Selector

Hi,

 

I am getting a strange result from my browser selector. I have specified
two xsl stylesheets, one for a PDA to run on AvantGo, and another for a
PC to run on Explorer. Now the expected result would be:

 

 

  PC    = Welcome to soundpool. Your are viewing this site from personal
computer

  PDA   = Welcome to soundpool. You are viewing this site from a PDA

 

 

But the result I get when loading the site for both devices is:

 

 

  Welcome to soundpool. Your are viewing this site from personal
computer Welcome to soundpool. You are viewing this site from a PDA

 

 

Why should it want to do this?

 

 

I have configured my browser selector as follows:

 

<map:selectors default="browser">

   <map:selector logger="sitemap.selector.browser" name="browser"
src="org.apache.cocoon.selection.BrowserSelector">

    <!-- # NOTE: The appearance indicates the search order. This is very
important since

         #       some words may be found in more than one browser
description. (MSIE is

         #       presented as "Mozilla/4.0 (Compatible; MSIE 4.01; ...")

    -->

    <browser name="explorer" useragent="MSIE"/>

    <browser name="pocketexplorer" useragent="MSPIE"/>

    <browser name="handweb" useragent="HandHTTP"/>

    <browser name="avantgo" useragent="AvantGo"/>

    <browser name="imode" useragent="DoCoMo"/>

    <browser name="opera" useragent="Opera"/>

    <browser name="lynx" useragent="Lynx"/>

    <browser name="java" useragent="Java"/>

    <browser name="wap" useragent="Nokia"/>

    <browser name="wap" useragent="UP"/>

    <browser name="wap" useragent="Wapalizer"/>

    <browser name="mozilla5" useragent="Mozilla/5"/>

    <browser name="mozilla5" useragent="Netscape6/"/>

    <browser name="netscape" useragent="Mozilla"/>

   </map:selector>

 

      <map:select>

            <map:when test="avantgo">

                  <map:transform src="stylesheets/soundpoolpda.xsl"/>

                  <map:seralize/>

            </map:when>

            <map:otherwise>

                  <map:transform src="stylesheets/soundpoolpc.xsl"/>

                  <map:seralize/>

            </map:otherwise>

      </map:select>

 

 

 

 

 

 

and my pipeline looks like this:

 

<!-- soundpool -->

 

<map:pipeline>

            <map:match pattern="soundpool/soundpool">

                  <map:generate src="soundpool.xml"/>

                  <map:serialize/>

            </map:match>

</map:pipeline>

 

 

 

What can you suggest?

 

Thanks

 

Richard.


AW: Browser Selector

Posted by Marco Rolappe <m_...@web.de>.
hi richard,

from what you wrote in your mail it seems you have misplaced the
<map:select>. those go into the pipeline definitions.

maybe it would be best if you read some introductory material on the sitemap
or have a look at samples sitemaps.

your sitemap should look something like this:

<!-- soundpool -->

<map:pipeline>
            <map:match pattern="soundpool/soundpool">
                  <map:generate src="soundpool.xml"/>

                  <map:select>
                  <map:when test="avantgo">
                      <map:transform src="stylesheets/soundpoolpda.xsl"/>
                  </map:when>
                  <map:otherwise>
                      <map:transform src="stylesheets/soundpoolpc.xsl"/>
                  </map:otherwise>
                  </map:select>

                  <map:serialize/>
            </map:match>
</map:pipeline>


-----Ursprungliche Nachricht-----
Von: cocoon-users-return-45964-m_rolappe=web.de@xml.apache.org
[mailto:cocoon-users-return-45964-m_rolappe=web.de@xml.apache.org]Im Auftrag
von Richard Cunliffe
Gesendet: Samstag, 1. Februar 2003 01:21
An: cocoon-users@xml.apache.org
Betreff: Browser Selector


Hi,

I am getting a strange result from my browser selector. I have specified two
xsl stylesheets, one for a PDA to run on AvantGo, and another for a PC to
run on Explorer. Now the expected result would be:


  PC    = Welcome to soundpool. Your are viewing this site from personal
computer
  PDA   = Welcome to soundpool. You are viewing this site from a PDA


But the result I get when loading the site for both devices is:


  Welcome to soundpool. Your are viewing this site from personal computer
Welcome to soundpool. You are viewing this site from a PDA


Why should it want to do this?


I have configured my browser selector as follows:

<map:selectors default="browser">
   <map:selector logger="sitemap.selector.browser" name="browser"
src="org.apache.cocoon.selection.BrowserSelector">
    <!-- # NOTE: The appearance indicates the search order. This is very
important since
         #       some words may be found in more than one browser
description. (MSIE is
         #       presented as "Mozilla/4.0 (Compatible; MSIE 4.01; ...")
    -->
    <browser name="explorer" useragent="MSIE"/>
    <browser name="pocketexplorer" useragent="MSPIE"/>
    <browser name="handweb" useragent="HandHTTP"/>
    <browser name="avantgo" useragent="AvantGo"/>
    <browser name="imode" useragent="DoCoMo"/>
    <browser name="opera" useragent="Opera"/>
    <browser name="lynx" useragent="Lynx"/>
    <browser name="java" useragent="Java"/>
    <browser name="wap" useragent="Nokia"/>
    <browser name="wap" useragent="UP"/>
    <browser name="wap" useragent="Wapalizer"/>
    <browser name="mozilla5" useragent="Mozilla/5"/>
    <browser name="mozilla5" useragent="Netscape6/"/>
    <browser name="netscape" useragent="Mozilla"/>
   </map:selector>

      <map:select>
            <map:when test="avantgo">
                  <map:transform src="stylesheets/soundpoolpda.xsl"/>
                  <map:seralize/>
            </map:when>
            <map:otherwise>
                  <map:transform src="stylesheets/soundpoolpc.xsl"/>
                  <map:seralize/>
            </map:otherwise>
      </map:select>






and my pipeline looks like this:

<!-- soundpool -->

<map:pipeline>
            <map:match pattern="soundpool/soundpool">
                  <map:generate src="soundpool.xml"/>
                  <map:serialize/>
            </map:match>
</map:pipeline>



What can you suggest?

Thanks

Richard.


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

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