You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peter Flynn <pf...@ucc.ie> on 2013/11/26 16:09:42 UTC

Getting the value of the browser selector

I can't see how to get the value of the browser selector into a 
parameter inside a map:transform in my sitemap.xmap.

The example I found shows how to push different transforms according to 
the value, eg

   <map:select type="browser">
     <map:when test="msie8">
       <map transform src="foo.xsl">
         <map:parameter name="browser" value="msie8"/>
       </map:transform>
     </map:when>
   ...etc...
   </map:select>

but that's a very long-winded, manual, and hard-coded way round. Is 
there a curly-brace syntax that would let me say

   <map:parameter name="browser" value="{something:browser}"/>

and simply have it pass the value to the XSLT stylesheet?

The selector for "browser" doesn't seem to have an "else" or default 
value. What happens when the user-agent string goes unmatched?

///Peter


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


Re: Getting the value of the browser selector

Posted by Peter Flynn <pf...@ucc.ie>.
Does anyone have any more information about the browser selector?
Specifically, how to pass its value into a pipeline as a parameter to 
the XSLT?

///Peter

On 19/12/13 15:51, Peter Flynn wrote:
> On 19/12/13 12:46, Christopher Schultz wrote:
>> Peter,
>>
>>> On Dec 19, 2013, at 4:24, Peter Flynn <pf...@ucc.ie> wrote:
>>>
>>> Let me try again in a shorter post :-)
>>>
>>> 1. Has anyone ever used the browser selector?
>>>
>>> 2. Can it be used to pass the *value* to a transformation as a
>>> parameter without resorting to map:when, instead of just doing
>>> selection?
>>
>> Isn't the "value" of the browser selector the same as the "user-agent"
>> header value?
>
> I don't think so.
> http://cocoon.apache.org/2.1/userdocs/browser-selector.html says:
>
> <map:select type="browser">
>    <map:when test="netscape">
>    ....
>    </map:when>
>    <map:when test="explorer">
>    ...
>    </map:when>
>    ...
>    <map:otherwise>
>    ...
>    </map:otherwise>
> </map:select>
>
> In other words you can take alternate action based on the test="..."
> value, but you cannot pass that actual value into the XSLT as a parameter.
>
>> You can just pass-in the header to the transformation... No need for
>> the browser selector.
>
> But then I'd have to parse the user-agent string in my XSLT. The whole
> point of the browser selector is that it's done for you in the sitemap.
>
> ///Peter


///Peter
-- 
Peter Flynn | Electronic Publishing Unit | IT Services | University 
College Cork | Phone +353 21 490 2609 | Email pflynn@ucc.ie | Web www.ucc.ie


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


Re: Getting the value of the browser selector

Posted by Peter Flynn <pf...@ucc.ie>.
On 19/12/13 12:46, Christopher Schultz wrote:
> Peter,
>
>> On Dec 19, 2013, at 4:24, Peter Flynn <pf...@ucc.ie> wrote:
>>
>> Let me try again in a shorter post :-)
>>
>> 1. Has anyone ever used the browser selector?
>>
>> 2. Can it be used to pass the *value* to a transformation as a parameter without resorting to map:when, instead of just doing selection?
>
> Isn't the "value" of the browser selector the same as the "user-agent" header value?

I don't think so. 
http://cocoon.apache.org/2.1/userdocs/browser-selector.html says:

<map:select type="browser">
   <map:when test="netscape">
   ....
   </map:when>
   <map:when test="explorer">
   ...
   </map:when>
   ...
   <map:otherwise>
   ...
   </map:otherwise>
</map:select>

In other words you can take alternate action based on the test="..." 
value, but you cannot pass that actual value into the XSLT as a parameter.

> You can just pass-in the header to the transformation... No need for the browser selector.

But then I'd have to parse the user-agent string in my XSLT. The whole 
point of the browser selector is that it's done for you in the sitemap.

///Peter
-- 
Peter Flynn | Electronic Publishing Unit | IT Services | University 
College Cork | Phone +353 21 490 2609 | Email pflynn@ucc.ie | Web www.ucc.ie


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


Re: Getting the value of the browser selector

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Peter,

> On Dec 19, 2013, at 4:24, Peter Flynn <pf...@ucc.ie> wrote:
> 
> Let me try again in a shorter post :-)
> 
> 1. Has anyone ever used the browser selector?
> 
> 2. Can it be used to pass the *value* to a transformation as a parameter without resorting to map:when, instead of just doing selection?

Isn't the "value" of the browser selector the same as the "user-agent" header value? You can just pass-in the header to the transformation... No need for the browser selector.

-chris

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


Getting the value of the browser selector

Posted by Peter Flynn <pf...@ucc.ie>.
Let me try again in a shorter post :-)

1. Has anyone ever used the browser selector?

2. Can it be used to pass the *value* to a transformation as a parameter 
without resorting to map:when, instead of just doing selection?

///Peter


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