cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C. Gaffga" <cgaf...@triplemind.com>
Subject Re: [C2] use-request-parameters=true
Date Sun, 15 Jul 2001 11:15:57 GMT
Thanks for answering.
My Problem is still the same, it doesn't matter if I use the request-taglib
or code it
directly in an xsp:logic-tag. The result is the same, it should output the
request
parameter but doesn't.

I've same problem (as in dynamic xsp generation) when I use aggregate in the
sitemap.
The request parameters are not available to the parts (not with
request-taglib nor
by using the request-Variable directly).

Is that a known Problem?
I need to use the request parameter during the generation of every dynamic
page.

Christoph Gaffga


----- Original Message -----
From: "Sergio Carvalho" <sergio.carvalho@acm.org>
To: "C. Gaffga" <cgaffga@triplemind.com>
Sent: Sunday, July 15, 2001 1:00 AM
Subject: Re: [C2] use-request-parameters=true


>
> Ok, now I get it. Set up the XSLT producing pipeline, just as if it were
any other pipeline. You can access the request parameters using the request
XSP taglib. You'll need to declare the request taglib namespace:
>  xmlns:xsp-request="http://apache.org/xsp/request/2.0"
>
> and then you can use:
> <xsp-request:get-parameter name="fgcolor" />
> on your XSP.
>
> Have a look at the file "/docs/samples/xsp/request-test.xsp" on your
cocoon distribution. You may also gain some insight from the source of the
request taglib:
> src/org/apache/cocoon/components/language/markup/xsp/java/request.xsl
> available either in the cocoon source files, or in the cocoon.jar file
under cocoon/WEB-INF/lib.
>
> Another alternative to generating a new stylesheet with the required
parameters, is to have a static stylesheet that processes the parameters
itself, with no XSP involved. This is the simpler solution, and I thought
you were going for it, It would look something like:
>
>   <map:match pattern="test.html">
>     <map:generate type="serverpages" src="page.xsp"/>
>     <map:transform src="test.xsl" />
>     <map:serialize type="html"/>
>    </map:match>
>
> Just don't forget step 1 on my previous e-mail, or parameters won't get
passed to the XSLT.
>
> Instead of having the transformer pass the parameters, you could also do
it on the pipeline using the request action (CVS version/upcoming beta) and
sitemap substitution, in which case you don't need to do the referred step
1:
>
>   <map:match pattern="test.html">
>    <map:act type="request">
>     <map:generate type="serverpages" src="page.xsp"/>
>     <map:transform src="est.xsl" >
>      <map:parameter name="color" value="{fgcolor}" />
>     </map:transform>
>     <map:serialize type="html"/>
>    </map:act>
>    </map:match>
>
> On Sat, 14 Jul 2001 13:36:55 +0200, "C. Gaffga" <cgaffga@triplemind.com>
wrote:
> --
> > Oh sorry, I want to use the parameters during stylesheet generation.
> > My stylesheet is a xsp-page looking for some request parameters and
> > session variables to get the colors customized by the user from the
> > database.
> > So, the stylesheet is dynamicly generated depending on the request.
> > But I had the problem that the request Variable doesn't contain
> > the parameters!
> > I had the same problem during using aggregate, the request is not
available
> > in the part generators.
> >
> > Is it my mistake or not the way cocoon works?
> > (I need the current request in every phase of generation, i thought that
is
> > for
> > what the cocoon:// protocol is for!?)
> >
> > Christoph Gaffga
> >
> >
> >
> > ----- Original Message -----
> > From: "Sergio Carvalho" <sergio.carvalho@acm.org>
> > To: <cocoon-users@xml.apache.org>
> > Sent: Friday, July 13, 2001 7:34 PM
> > Subject: Re: [C2] use-request-parameters=true
> >
> >
> > >
> > > Do you want to use the request parameter *in* the XSLT or *producing*
the
> > XSLT? You mentioned using it in the XSLT but your sample uses it in XSP
> > instead.
> > >
> > > You sample should work, even without the <map:parameter
> > name="use-request-parameters" value="true"/>.
> > >
> > > On the other hand, if you want to use the parameters in the XSLT, then
> > what you need to do is this:
> > >  1) Edit sitemap.xmap; change
> > >
> > > <map:transformer     name="xslt"
> > src="org.apache.cocoon.transformation.TraxTransformer">
> > >     <use-store>false</use-store>
> > >     <use-request-parameters>true</use-request-parameters>
> > >
> > > to
> > >
> > > <map:transformer     name="xslt"
> > src="org.apache.cocoon.transformation.TraxTransformer">
> > >     <use-store>true</use-store>
> > >     <use-request-parameters>true</use-request-parameters>
> > >
> > >  2) Declare the parameter in your XSLT. e.g:
> > >
> > > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> > >   <xsl:param name="siteSection">/</xsl:param>
> > >
> > >  3) Use the parameter, available as $siteSection in the example. e.g:
> > >
> > > <xsl:when test="$siteSection = '/frontPage'">
> > >
> > > Hope this helps,
> > >
> > > On Fri, 13 Jul 2001 15:24:12 +0200, "C. Gaffga"
<cgaffga@triplemind.com>
> > wrote:
> > > --
> > > > I'm using cocoon 2.1-dev (12.07.2001).
> > > > I want to use the request in a dynamic generated Stylesheet using
the
> > > > following sitemap:
> > > >
> > > >    <map:match pattern="test.xsl">
> > > >      <map:generate type="serverpages" src="stylesheet.xsp"/>
> > > >      <map:serialize type="xml"/>
> > > >    </map:match>
> > > >
> > > >    <map:match pattern="test.html">
> > > >     <map:generate type="serverpages" src="page.xsp"/>
> > > >     <map:transform src="cocoon://test.xsl">
> > > >       <map:parameter name="use-request-parameters" value="true"/>
> > > >     </map:transform>
> > > >     <map:serialize type="html"/>
> > > >    </map:match>
> > > >
> > > > I have the following im my stylesheet.xsp for testing:
> > > >
> > > >     Request Parameter:
> > > >     <ul><xsp:logic>
> > > >     {
> > > >       java.util.Enumeration x = request.getParameterNames();
> > > >       while(x.hasMoreElements()) {
> > > >         String s = (String) x.nextElement();
> > > >         <xsp:content>
> > > >           <li><xsp:expr>s</xsp:expr> =
> > > > <xsp:expr>request.getParameter(s)</xsp:expr></li>
> > > >         </xsp:content>
> > > >       }
> > > >     }
> > > >     </xsp:logic></ul>
> > > >
> > > > But there are no parameters outputted! Is it a bug or my mistake?
> > > > Please help.
> > > >
> > > > Christoph Gaffga
> > > >
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > 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: <cocoon-users-unsubscribe@xml.apache.org>
> > > > For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
> > > >
> > >
> > >
> > >
> > > --
> > > Sergio Carvalho
> > > ---------------
> > > sergio.carvalho@acm.org
> > >
> > > If at first you don't succeed, skydiving is not for you
> > >
> > > ---------------------------------------------------------------------
> > > 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: <cocoon-users-unsubscribe@xml.apache.org>
> > > For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
> > >
> >
>
>
>
> --
> Sergio Carvalho
> ---------------
> sergio.carvalho@acm.org
>
> If at first you don't succeed, skydiving is not for you
>


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


Mime
View raw message