You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Johannes Koch <ko...@pixelpark.com> on 2002/02/18 20:20:04 UTC

Cocoon2: select with 'accepts()'

Hi there,

in [1] Stefano Mazzocchi gives the following example:

<map:match pattern="images/logo">
 <map:generate src="./images/logo.svg"/>
 <map:select type="browser">
  <map:when test="accepts('image/png')">
   <map:serialize type="svg2png"/>
  </map:when>
  <map:otherwise>
   <map:serialize type="svg2jpg"/>
  </map:otherwise>
 </map:select>
</map:match>

He uses 'accepts()' in the value for the test attribute.

I tried the following with no success (Cocoon 2.0 on Tomcat 4.0, Win NT
4.0 SP6):

<map:match pattern="test/">
  <map:generate src="docs/test/index.xml"/>
  <map:select type="browser">
    <map:when test="accepts('text/vnd.wap.wml')">
      <map:transform src="stylesheets/test/wap/test.xsl"/>
      <map:serialize type="wap"/>
    </map:when>
    <map:otherwise>
      <map:transform src="stylesheets/test/screen/test.xsl"/>
      <map:serialize type="html"/>
    </map:otherwise>
  </map:select>
</map:match>

I used the Nokia Mobile Toolkit. The string 'text/vnd.wap.wml' is part
of the Accept Header. But the HTML version was served. What is wrong
with my example?

[1] http://www.xml.com/lpt/a/2002/02/13/cocoon2.html
-- 
Johannes Koch  . IT Developer
Pixelpark AG   . http://www.pixelpark.com
Rotherstraße 8 . 10245 Berlin  .  Germany
phone: +49 30 5058 - 1288  .  fax: - 1355

---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: Cocoon2: select with 'accepts()'

Posted by Sean Malone <ma...@indigo.ie>.
There are only a limited number of wap browsers out there, most use the
phone.com, the default selector covers the majority.

-----Original Message-----
From: Johannes Koch [mailto:koch@pixelpark.com]
Sent: 18 February 2002 20:49
To: cocoon-users@xml.apache.org
Subject: Re: Cocoon2: select with 'accepts()'


Sean Malone schrieb:
>
> You should use
>
>  <map:when test="wap">
>
>  this will be true when you open the url using the Nokia emulator
>  look at the default selector in sitemap.xmap

Sure it is for Nokia emulator. But I _don't_ want to add each and every
wap browser's User-Agent to <map:selector> (and forget one or another).
So: how can I make Stefano's example working?
--
Johannes Koch  . IT Developer
Pixelpark AG   . http://www.pixelpark.com
Rotherstraße 8 . 10245 Berlin  .  Germany
phone: +49 30 5058 - 1288  .  fax: - 1355

---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>



---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Cocoon2: select with 'accepts()'

Posted by Johannes Koch <ko...@pixelpark.com>.
Sean Malone schrieb:
> 
> You should use
> 
>  <map:when test="wap">
> 
>  this will be true when you open the url using the Nokia emulator
>  look at the default selector in sitemap.xmap

Sure it is for Nokia emulator. But I _don't_ want to add each and every
wap browser's User-Agent to <map:selector> (and forget one or another).
So: how can I make Stefano's example working?
-- 
Johannes Koch  . IT Developer
Pixelpark AG   . http://www.pixelpark.com
Rotherstraße 8 . 10245 Berlin  .  Germany
phone: +49 30 5058 - 1288  .  fax: - 1355

---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: Cocoon2: select with 'accepts()'

Posted by Sean Malone <ma...@indigo.ie>.
You should use

 <map:when test="wap">

 this will be true when you open the url using the Nokia emulator
 look at the default selector in sitemap.xmap

-----Original Message-----
From: Johannes Koch [mailto:koch@pixelpark.com]
Sent: 18 February 2002 19:20
To: cocoon-users Mailingliste
Subject: Cocoon2: select with 'accepts()'


Hi there,

in [1] Stefano Mazzocchi gives the following example:

<map:match pattern="images/logo">
 <map:generate src="./images/logo.svg"/>
 <map:select type="browser">
  <map:when test="accepts('image/png')">
   <map:serialize type="svg2png"/>
  </map:when>
  <map:otherwise>
   <map:serialize type="svg2jpg"/>
  </map:otherwise>
 </map:select>
</map:match>

He uses 'accepts()' in the value for the test attribute.

I tried the following with no success (Cocoon 2.0 on Tomcat 4.0, Win NT
4.0 SP6):

<map:match pattern="test/">
  <map:generate src="docs/test/index.xml"/>
  <map:select type="browser">
    <map:when test="accepts('text/vnd.wap.wml')">
      <map:transform src="stylesheets/test/wap/test.xsl"/>
      <map:serialize type="wap"/>
    </map:when>
    <map:otherwise>
      <map:transform src="stylesheets/test/screen/test.xsl"/>
      <map:serialize type="html"/>
    </map:otherwise>
  </map:select>
</map:match>

I used the Nokia Mobile Toolkit. The string 'text/vnd.wap.wml' is part
of the Accept Header. But the HTML version was served. What is wrong
with my example?

[1] http://www.xml.com/lpt/a/2002/02/13/cocoon2.html
--
Johannes Koch  . IT Developer
Pixelpark AG   . http://www.pixelpark.com
Rotherstraße 8 . 10245 Berlin  .  Germany
phone: +49 30 5058 - 1288  .  fax: - 1355

---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>



---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>