You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by EliSF <el...@wavemarket.com> on 2009/01/20 01:56:31 UTC

JavaScript in stylesheet vs. in sitemap flow

hi -
Extreme newbie here, apologies in advance.

I have an XSLT stylesheet that needs to know some information from the HTTP
request -- specifically, a cookie value.  I know there is an option for
making cookies available to the XSLT transformer, but I don't think changing
the transformer is an option in this case, because this is within Daisy and
I need the rest of the Daisy webapp to behave as usual.  I see two promising
approaches, but I'm unclear on how to apply them:

1. Add an extension to the sitemap.  I see how to create a pipeline that
will call my JavaScript code, and I can get the cookie value within JS.  But
then I don't see how to get this value from within the XSLT that's in the
Daisy pipeline.  I don't want to actually generate web content from within
the extension -- that should stay in the XSLT.

2. Define a JS extension function within the stylesheet itself.  As long as
I have bsf.jar, this works fine... except that now my JS code doesn't seem
to have access to the Cocoon API, or at least to the global variable
"cocoon"; so I can't refer to the current request and get its cookies.

This seems like it shouldn't be a terribly unusual thing to want to do, and
I'm hoping I've missed some really obvious solution.  I've asked around on
the Daisy list too, but I don't think this is anything Daisy-specific (apart
from the limitation of not wanting to mess with the currently defined
pipeline).

thanks,
Eli
-- 
View this message in context: http://www.nabble.com/JavaScript-in-stylesheet-vs.-in-sitemap-flow-tp21555056p21555056.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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


RE: JavaScript in stylesheet vs. in sitemap flow

Posted by Robby Pelssers <ro...@ciber.nl>.
In the cocoon.xconf there is a cookiemodule configured which you can
easily use in your sitemap

        <component-instance logger="core.modules.input" name="cookie"
 
class="org.apache.cocoon.components.modules.input.CookieModule" />

At http://cocoon.apache.org/2.1/userdocs/concepts/modules-ref.html You
see  how to use the cookiemodule to pass cookies to your xslt:

Example Pipeline Fragment:

<map:match pattern="foo.html">
  <map:generate type="file"
src="documents/{cookie:user-language}/foo.xml"/>
  <map:transform src="stylesheets/foo2html.xsl"/>
  <map:serialize/>
</map:match>

Cheers,
Robby Pelssers

-----Original Message-----
From: EliSF [mailto:eli@wavemarket.com] 
Sent: dinsdag 20 januari 2009 3:23
To: users@cocoon.apache.org
Subject: Re: JavaScript in stylesheet vs. in sitemap flow



Well, this still might be an interesting question but I found a
different,
simpler approach that makes it all moot.  I'd still be curious if anyone
had
an answer, but don't knock yourselves out.  Thanks anyway!
-- 
View this message in context:
http://www.nabble.com/JavaScript-in-stylesheet-vs.-in-sitemap-flow-tp215
55056p21555824.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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


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


Re: JavaScript in stylesheet vs. in sitemap flow

Posted by EliSF <el...@wavemarket.com>.

Well, this still might be an interesting question but I found a different,
simpler approach that makes it all moot.  I'd still be curious if anyone had
an answer, but don't knock yourselves out.  Thanks anyway!
-- 
View this message in context: http://www.nabble.com/JavaScript-in-stylesheet-vs.-in-sitemap-flow-tp21555056p21555824.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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