Using xxforms functions in Theme XSL file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Using xxforms functions in Theme XSL file

Hoi Chong
Hi,
There is this new Orbeon Forms function, xxforms:get-request-header('User-Agent') that will return a user-agent string. How can I use this function within the Orbeon theme xsl file?

Anybody tried this before?

Thanks and regards.
Hoi Chong
Reply | Threaded
Open this post in threaded view
|

Re: Using xxforms functions in Theme XSL file

Hank Ratzesberger

Hoi,

The xxforms functions are available in XForms, that is, after the
page is loaded in the browser.

In the XSLT stage, you can use the Request Generator to get this
information into the xsl data or xsl variable.

http://www.orbeon.com/ops/doc/processors-generators-request


--Hank


On Feb 16, 2009, at 7:29 AM, hoichong wrote:

>
> Hi,
> There is this new Orbeon Forms function,
> xxforms:get-request-header('User-Agent') that will return a user-agent
> string. How can I use this function within the Orbeon theme xsl file?
>
> Anybody tried this before?
>
> Thanks and regards.
> Hoi Chong
> --  
> View this message in context: http://www.nabble.com/Using-xxforms- 
> functions-in-Theme-XSL-file-tp22039368p22039368.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email]  
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042







--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Using xxforms functions in Theme XSL file - browser detection

Hoi Chong
Hank,
Thanks for the tip.

I have to modify the epilogue-servlet.xpl to get the user-agent request...

    <!-- Get request information -->
    <p:processor name="oxf:request">
        <p:input name="config">
            <config>
                <include>/request/container-type</include>
                <include>/request/request-path</include>
                <include>/request/headers/header[name =
'user-agent']</include>
                <include>/request/headers/header[name = 'accept']</include>
                <include>/request/parameters/parameter[starts-with(name,
'orbeon')]</include>
            </config>
        </p:input>
        <p:output name="data" id="request"/>
    </p:processor>

Then in my custom theme, I retrieve the user-agent value and assign to a
XSL variable.
After that I can check that variable and conditionally include in CSS or
JS files depending on the browser.

    <xsl:variable name="request" select="doc('input:request')"
as="document-node()"/>
    <xsl:variable name="current-user-agent"
select="$request/*/headers/header[name='user-agent']/value" as="xs:string"/>

                <xsl:if test="matches($current-user-agent,'MSIE 6.0')">
                  <xhtml:link rel="stylesheet"
href="/config/rbpf-theme/rbpf_ie6hc.css" type="text/css"/>
                </xsl:if>

Hope this is useful for others that are looking for ways to handle IE
peculiarities.

Regards.




Hank Ratzesberger wrote:

>
> Hoi,
>
> The xxforms functions are available in XForms, that is, after the
> page is loaded in the browser.
>
> In the XSLT stage, you can use the Request Generator to get this
> information into the xsl data or xsl variable.
>
> http://www.orbeon.com/ops/doc/processors-generators-request
>
>
> --Hank
>
>
> On Feb 16, 2009, at 7:29 AM, hoichong wrote:
>
>>
>> Hi,
>> There is this new Orbeon Forms function,
>> xxforms:get-request-header('User-Agent') that will return a user-agent
>> string. How can I use this function within the Orbeon theme xsl file?
>>
>> Anybody tried this before?
>>
>> Thanks and regards.
>> Hoi Chong
>> -- View this message in context:
>> http://www.nabble.com/Using-xxforms-functions-in-Theme-XSL-file-tp22039368p22039368.html 
>>
>> Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
>>
>>
>> --
>> You receive this message as a subscriber of the [hidden email]
>> mailing list.
>> To unsubscribe: mailto:[hidden email]
>> For general help: mailto:[hidden email]?subject=help
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>
> Hank Ratzesberger
> NEES@UCSB
> Institute for Crustal Studies,
> University of California, Santa Barbara
> 805-893-8042
>
>
>
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws