You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jarry Liu <ja...@gmail.com> on 2005/04/19 16:56:24 UTC

How can I pass this parameter to xsl file

Hi everyone,

I have a question about parameter passing from script file to xsl as following:

   
in file  " tran.js ":

 function selectcol(){
    var colle= cocoon.request.get("collection");
    cocoon.sendpage("browse/", {col:colle});
}


in sitemap.xmap:

<map:match pattern="browse/**">
   <map:generate src="file:///Users/{1}" type= "directory"/>
   <map:transform src="dir.xsl"/>
 .....


Then, in " dir.xsl ", how can I get the value of "col" which was sent
from file "tran.js"?

Thanks for your kind help.

Jarry

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


Re: How can I pass this parameter to xsl file

Posted by Jarry Liu <ja...@gmail.com>.
Upayavira,

I don't really understand the deep rules in the sitemap, but Peter's
solution really works for me.

I did an experiment and try to looply use this section of sitemap, the
first time I get parameter col  from javascript and the next time I
send parameter col from a html form. I got the correct result in both
way. So as for <request-param ...> in sitemap, it handle the parameter
both from Javascript function and html form.  I am not sure if I
understand it rightly.

Regards, Jarry







On 4/19/05, Upayavira <uv...@upaya.co.uk> wrote:
> Jarry Liu wrote:
> > Great! It works!
> 
> It works? I can't see how. The 'col' is stored as a flow attribute, not
> into a request parameter. Unless you have a request parameter called
> col as well. So you should use the flow-attribute input module to get at
> the value.
> 
> I think the syntax is:
> 
> cocoon.sendPage("browse/", {col:colle});
> 
> <map:generate src="file:///Users/{flow-attribute:col}"/>
> 
> That should be the correct syntax.
> 
> Regards, Upayavira
> 
> > On 4/19/05, Peter Kröpfl <pe...@groebi.com> wrote:
> >
> >>>in file  " tran.js ":
> >>>
> >>> function selectcol(){
> >>>    var colle= cocoon.request.get("collection");
> >>>    cocoon.sendpage("browse/", {col:colle});
> >>>}
> >>>
> >>>in sitemap.xmap:
> >>>
> >>><map:match pattern="browse/**">
> >>>   <map:generate src="file:///Users/{1}" type= "directory"/>
> >>>   <map:transform src="dir.xsl"/>
> >>> .....
> >>>
> >>
> >>you could try to do the following:
> >>
> >><map:transform src="dir.xsl">
> >>  <map:parameter name="parameter_name" value="{request-param:col}"/>
> >></map:transform>
> >>
> >>and in your xsl:
> >>
> >><xsl:param name="parameter_name"/>
> >>
> >>and use it like this:
> >>
> >><blabla value="{$parameter_name}/" />
> >>
> >>I have not tested this code, but i think it could be working ;-)
> >>
> >>hth,
> >>peter
> >>
> >>---------------------------------------------------------------------
> >>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
> >
> >
> 
> ---------------------------------------------------------------------
> 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: How can I pass this parameter to xsl file

Posted by Upayavira <uv...@upaya.co.uk>.
Jarry Liu wrote:
> Great! It works! 

It works? I can't see how. The 'col' is stored as a flow attribute, not 
into a request parameter. Unless you have a request parameter called 
col as well. So you should use the flow-attribute input module to get at 
the value.

I think the syntax is:

cocoon.sendPage("browse/", {col:colle});

<map:generate src="file:///Users/{flow-attribute:col}"/>

That should be the correct syntax.

Regards, Upayavira

> On 4/19/05, Peter Kröpfl <pe...@groebi.com> wrote:
> 
>>>in file  " tran.js ":
>>>
>>> function selectcol(){
>>>    var colle= cocoon.request.get("collection");
>>>    cocoon.sendpage("browse/", {col:colle});
>>>}
>>>
>>>in sitemap.xmap:
>>>
>>><map:match pattern="browse/**">
>>>   <map:generate src="file:///Users/{1}" type= "directory"/>
>>>   <map:transform src="dir.xsl"/>
>>> .....
>>>
>>
>>you could try to do the following:
>>
>><map:transform src="dir.xsl">
>>  <map:parameter name="parameter_name" value="{request-param:col}"/>
>></map:transform>
>>
>>and in your xsl:
>>
>><xsl:param name="parameter_name"/>
>>
>>and use it like this:
>>
>><blabla value="{$parameter_name}/" />
>>
>>I have not tested this code, but i think it could be working ;-)
>>
>>hth,
>>peter
>>
>>---------------------------------------------------------------------
>>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
> 
> 


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


Re: How can I pass this parameter to xsl file

Posted by Jarry Liu <ja...@gmail.com>.
Great! It works! 

Thanks Peter.





On 4/19/05, Peter Kröpfl <pe...@groebi.com> wrote:
> 
> > in file  " tran.js ":
> >
> >  function selectcol(){
> >     var colle= cocoon.request.get("collection");
> >     cocoon.sendpage("browse/", {col:colle});
> > }
> >
> > in sitemap.xmap:
> >
> > <map:match pattern="browse/**">
> >    <map:generate src="file:///Users/{1}" type= "directory"/>
> >    <map:transform src="dir.xsl"/>
> >  .....
> >
> 
> you could try to do the following:
> 
> <map:transform src="dir.xsl">
>   <map:parameter name="parameter_name" value="{request-param:col}"/>
> </map:transform>
> 
> and in your xsl:
> 
> <xsl:param name="parameter_name"/>
> 
> and use it like this:
> 
> <blabla value="{$parameter_name}/" />
> 
> I have not tested this code, but i think it could be working ;-)
> 
> hth,
> peter
> 
> ---------------------------------------------------------------------
> 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: How can I pass this parameter to xsl file

Posted by Peter Kröpfl <pe...@groebi.com>.
> in file  " tran.js ":
> 
>  function selectcol(){
>     var colle= cocoon.request.get("collection");
>     cocoon.sendpage("browse/", {col:colle});
> }
> 
> in sitemap.xmap:
> 
> <map:match pattern="browse/**">
>    <map:generate src="file:///Users/{1}" type= "directory"/>
>    <map:transform src="dir.xsl"/>
>  .....
>

you could try to do the following:

<map:transform src="dir.xsl">
  <map:parameter name="parameter_name" value="{request-param:col}"/>
</map:transform>

and in your xsl:

<xsl:param name="parameter_name"/>

and use it like this:

<blabla value="{$parameter_name}/" />


I have not tested this code, but i think it could be working ;-)


hth,
peter



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