You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Marcin Okraszewski <ok...@o2.pl> on 2004/02/05 22:20:27 UTC

[XSP logicsheet] How to pass parameter to XSP logicsheet ???

Hi,
I need path of processed file by a XSP logicsheet (ie. XSL transform). 
This could be also a request object.

Normally I could pass a parameter to XSL but when it is a logicsheet I 
don't know how to do it.

Regards,
Marcin Okraszewski

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


Re: [XSP logicsheet] How to pass parameter to XSP logicsheet ???

Posted by Olivier Billard <ob...@rennes.jouve.fr>.
You can also take a look at
http://cocoon.apache.org/2.1/userdocs/xsp/index.html

-- 
Olivier BILLARD


On 05/02/2004 22:20, Marcin Okraszewski wrote:

> Hi,
> I need path of processed file by a XSP logicsheet (ie. XSL transform). 
> This could be also a request object.
> 
> Normally I could pass a parameter to XSL but when it is a logicsheet I 
> don't know how to do it.
> 
> Regards,
> Marcin Okraszewski


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


Re: [XSP logicsheet] How to pass parameter to XSP logicsheet ???

Posted by Mark Leicester <ma...@energyintellect.com>.
Hello Marcin,

Ahh, now I see - if I understand correctly then what you want is  
something like this:

XSP Page:
<xsp:page  ... all necessary namespaces... >
   <some-outer-tag>
     <test:div denominator="1"/>
   </some-outer-tag>
</xsp:page>

XSL Logicsheet:
<xsl:stylesheet ... all necessary namespaces... >
   ...
   <xsl:template match="test:div">
     <test:result>
       <xsl:choose>
         <xsl:when test="number(@denominator) != 0"> <!-- using  
attribute, not parameter -->
	  <xsp-request:get-parameter name="over"/>
           <xsl:text> / </xsl:text>
           <xsl:value-of select="@denominator"/>
	  <xsl:text> = </xsl:text>
	  <xsp:expr>
	   Integer.parseInt(<xsp-request:get-parameter name="over"/>)
	   / <xsl:value-of select="@denominator"/>
           </xsp:expr>
         </xsl:when>
         <xsl:otherwise>
	  <xsl:text>You cannot divide by 0!</xsl:text>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:copy>
   </xsl:template>
   <!-- need an identity template too -->
</xsl:stylesheet>

I'd recommend for readability that you pass in the "over" value via a  
tag too.
I hope this is what you're after! :)

Regards,
Mark

On 9 Feb 2004, at 20:35, Marcin Okraszewski wrote:

> Hi Mark,
> We still speak about different things. I want to make a *conditional  
> compilation* of XSP page (something like #ifdef in C). To do so I need  
> to pass some parameter to XSL logics sheet (the one that translates  
> XSP to Java). Lets consider fallowing example:
>
> <xsl:stylesheet>
>   <xsl:param name="denominator">
>
>   <xsl:template match="test:div">
>     <test:result>
>       <xsl:choose>
>         <xsl:when test="number($denominator) != 0">
> 	  <xsp-request:get-parameter name="over"/>
>           <xsl:text> / </xsl:text>
>           <xsl:value-of select="$denominator"/>
> 	  <xsl:text> = </xsl:text>
> 	  <xsp:expr>
> 	   Integer.parseInt(<xsp-request:get-parameter name="over"/>)
> 	   / <xsl:value-of select="$denominator"/>
>           </xsp:expr>
>         </xsl:when>
>         <xsl:otherwise>
> 	  <xsl:text>You cannot divide by 0!</xsl:text>
>         </xsl:otherwise>
>       </xsl:choose>
>     </xsl:copy>
>   </xsl:template>
> </xsl:stylesheet>
>
> and page
>
> <xsl:page>
>   <test:div/>
> </xsl:page>
>
> As you probably see, the page divides request number by a number that  
> was specified to logicsheet by <xsl:param>. The denominator is set  
> only once, (before compiling page). There is no point in checking the  
> denominator for every single request, just while compiling xsp page.
>
> And now - how to pass pass the /value/ parameter to logic sheet other  
> way than by some tag inside the page that is going to be compiled?
>
> Regards,
> Marcin Okraszewski
>
>
>
>
>> Hi Marcin,
>> So you are asking how to pass a parameter value from the sitemap,  
>> through an XSP, into a logicsheet?
>> If so, this is quite simple. I expect you have looked at this page?
>> http://cocoon.apache.org/2.1/userdocs/xsp/logicsheet-concepts.html
>> The first section explains how to pass request parameters into logic  
>> sheets (see the example using <xsp-request:get-parameter>). If you  
>> want to pass in sitemap parameters to a logicsheet (and not request  
>> parameters like the example here) then you should use the parameter  
>> fetching code as outlined in the mail archive links I sent before  
>> (instead of the <xsp-request:get-parameter>). Remember your  
>> logicsheet generates java code which is *compiled*: you can always  
>> look at the generated Java class files if you look in the work  
>> directory.
>> I hope this helps!
>> Mark
>> On 9 Feb 2004, at 15:32, Marcin Okraszewski wrote:
>>> Hi,
>>> Well, not quite. I mean getting the file on TRANSLATION  
>>> (compilation) time! So that I can obtain it by XSLT, like this:
>>>
>>> <xsl:param name="test"/>
>>>
>>> <xsl:template match="test">
>>>   <xsl:copy>
>>>     <xsl:value-of select="$test"/>
>>>   </xsl:copy>
>>> </xsl:template>
>>>
>>> and the solution described there is at execution time (XSP, not XSL).
>>>
>>> Regards,
>>> Marcin Okraszewski
>>>
>>>
>>>
>>>> Hi Marcin,
>>>>  From your question, I think that Oliver was on the right track  
>>>> with his suggestion that you look in the archives. Maybe these  
>>>> links will help you?
>>>> I have used this technique:
>>>> http://marc.theaimsgroup.com/?l=xml-cocoon- 
>>>> users&m=105483065103410&w=2
>>>> I believe there is also a "util" logicsheet to do this (but I have  
>>>> never used it myself):
>>>> http://marc.theaimsgroup.com/?l=xml-cocoon- 
>>>> users&m=106806037121755&w=2
>>>> Regards,
>>>> Mark
>>>> On 6 Feb 2004, at 21:16, Marcin Okraszewski wrote:
>>>>
>>>>> I'm afraid you misunderstand me. I mean to pass parameter to  
>>>>> logicsheet while translating xsp to java!
>>>>>
>>>>> I tried with:
>>>>>
>>>>>       <map:generate type="serverpages" src="test.xsp">
>>>>>         <map:parameter name="test" value="this is test"/>
>>>>>       </map:generate>
>>>>>       <map:serialize type="xml"/>
>>>>>
>>>>> But it didn't work :-(
>>>>>
>>>>> Regards,
>>>>> Marcin Okraszewski
>
>
> ---------------------------------------------------------------------
> 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: [XSP logicsheet] How to pass parameter to XSP logicsheet ???

Posted by Marcin Okraszewski <ok...@o2.pl>.
Hi Mark,
We still speak about different things. I want to make a *conditional 
compilation* of XSP page (something like #ifdef in C). To do so I need 
to pass some parameter to XSL logics sheet (the one that translates XSP 
to Java). Lets consider fallowing example:

<xsl:stylesheet>
   <xsl:param name="denominator">

   <xsl:template match="test:div">
     <test:result>
       <xsl:choose>
         <xsl:when test="number($denominator) != 0">
	  <xsp-request:get-parameter name="over"/>
           <xsl:text> / </xsl:text>
           <xsl:value-of select="$denominator"/>
	  <xsl:text> = </xsl:text>
	  <xsp:expr>
	   Integer.parseInt(<xsp-request:get-parameter name="over"/>)
	   / <xsl:value-of select="$denominator"/>
           </xsp:expr>
         </xsl:when>
         <xsl:otherwise>
	  <xsl:text>You cannot divide by 0!</xsl:text>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:copy>
   </xsl:template>
</xsl:stylesheet>

and page

<xsl:page>
   <test:div/>
</xsl:page>

As you probably see, the page divides request number by a number that 
was specified to logicsheet by <xsl:param>. The denominator is set only 
once, (before compiling page). There is no point in checking the 
denominator for every single request, just while compiling xsp page.

And now - how to pass pass the /value/ parameter to logic sheet other 
way than by some tag inside the page that is going to be compiled?

Regards,
Marcin Okraszewski




> Hi Marcin,
> 
> So you are asking how to pass a parameter value from the sitemap, 
> through an XSP, into a logicsheet?
> 
> If so, this is quite simple. I expect you have looked at this page?
> http://cocoon.apache.org/2.1/userdocs/xsp/logicsheet-concepts.html
> 
> The first section explains how to pass request parameters into logic 
> sheets (see the example using <xsp-request:get-parameter>). If you want 
> to pass in sitemap parameters to a logicsheet (and not request 
> parameters like the example here) then you should use the parameter 
> fetching code as outlined in the mail archive links I sent before 
> (instead of the <xsp-request:get-parameter>). Remember your logicsheet 
> generates java code which is *compiled*: you can always look at the 
> generated Java class files if you look in the work directory.
> 
> I hope this helps!
> Mark
> 
> On 9 Feb 2004, at 15:32, Marcin Okraszewski wrote:
> 
>> Hi,
>> Well, not quite. I mean getting the file on TRANSLATION (compilation) 
>> time! So that I can obtain it by XSLT, like this:
>>
>> <xsl:param name="test"/>
>>
>> <xsl:template match="test">
>>   <xsl:copy>
>>     <xsl:value-of select="$test"/>
>>   </xsl:copy>
>> </xsl:template>
>>
>> and the solution described there is at execution time (XSP, not XSL).
>>
>> Regards,
>> Marcin Okraszewski
>>
>>
>>
>>> Hi Marcin,
>>>  From your question, I think that Oliver was on the right track with 
>>> his suggestion that you look in the archives. Maybe these links will 
>>> help you?
>>> I have used this technique:
>>> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=105483065103410&w=2
>>> I believe there is also a "util" logicsheet to do this (but I have 
>>> never used it myself):
>>> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=106806037121755&w=2
>>> Regards,
>>> Mark
>>> On 6 Feb 2004, at 21:16, Marcin Okraszewski wrote:
>>>
>>>> I'm afraid you misunderstand me. I mean to pass parameter to 
>>>> logicsheet while translating xsp to java!
>>>>
>>>> I tried with:
>>>>
>>>>       <map:generate type="serverpages" src="test.xsp">
>>>>         <map:parameter name="test" value="this is test"/>
>>>>       </map:generate>
>>>>       <map:serialize type="xml"/>
>>>>
>>>> But it didn't work :-(
>>>>
>>>> Regards,
>>>> Marcin Okraszewski


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


Re: [XSP logicsheet] How to pass parameter to XSP logicsheet ???

Posted by Mark Leicester <ma...@energyintellect.com>.
Hi Marcin,

So you are asking how to pass a parameter value from the sitemap, 
through an XSP, into a logicsheet?

If so, this is quite simple. I expect you have looked at this page?
http://cocoon.apache.org/2.1/userdocs/xsp/logicsheet-concepts.html

The first section explains how to pass request parameters into logic 
sheets (see the example using <xsp-request:get-parameter>). If you want 
to pass in sitemap parameters to a logicsheet (and not request 
parameters like the example here) then you should use the parameter 
fetching code as outlined in the mail archive links I sent before 
(instead of the <xsp-request:get-parameter>). Remember your logicsheet 
generates java code which is *compiled*: you can always look at the 
generated Java class files if you look in the work directory.

I hope this helps!
Mark

On 9 Feb 2004, at 15:32, Marcin Okraszewski wrote:

> Hi,
> Well, not quite. I mean getting the file on TRANSLATION (compilation) 
> time! So that I can obtain it by XSLT, like this:
>
> <xsl:param name="test"/>
>
> <xsl:template match="test">
>   <xsl:copy>
>     <xsl:value-of select="$test"/>
>   </xsl:copy>
> </xsl:template>
>
> and the solution described there is at execution time (XSP, not XSL).
>
> Regards,
> Marcin Okraszewski
>
>
>
>> Hi Marcin,
>>  From your question, I think that Oliver was on the right track with 
>> his suggestion that you look in the archives. Maybe these links will 
>> help you?
>> I have used this technique:
>> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=105483065103410&w=2
>> I believe there is also a "util" logicsheet to do this (but I have 
>> never used it myself):
>> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=106806037121755&w=2
>> Regards,
>> Mark
>> On 6 Feb 2004, at 21:16, Marcin Okraszewski wrote:
>>> I'm afraid you misunderstand me. I mean to pass parameter to 
>>> logicsheet while translating xsp to java!
>>>
>>> I tried with:
>>>
>>>       <map:generate type="serverpages" src="test.xsp">
>>>         <map:parameter name="test" value="this is test"/>
>>>       </map:generate>
>>>       <map:serialize type="xml"/>
>>>
>>> But it didn't work :-(
>>>
>>> Regards,
>>> Marcin Okraszewski
>
>
> ---------------------------------------------------------------------
> 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: [XSP logicsheet] How to pass parameter to XSP logicsheet ???

Posted by Marcin Okraszewski <ok...@o2.pl>.
Hi,
Well, not quite. I mean getting the file on TRANSLATION (compilation) 
time! So that I can obtain it by XSLT, like this:

<xsl:param name="test"/>

<xsl:template match="test">
   <xsl:copy>
     <xsl:value-of select="$test"/>
   </xsl:copy>
</xsl:template>

and the solution described there is at execution time (XSP, not XSL).

Regards,
Marcin Okraszewski



> Hi Marcin,
> 
>  From your question, I think that Oliver was on the right track with his 
> suggestion that you look in the archives. Maybe these links will help you?
> 
> I have used this technique:
> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=105483065103410&w=2
> 
> I believe there is also a "util" logicsheet to do this (but I have never 
> used it myself):
> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=106806037121755&w=2
> 
> Regards,
> Mark
> 
> On 6 Feb 2004, at 21:16, Marcin Okraszewski wrote:
> 
>> I'm afraid you misunderstand me. I mean to pass parameter to 
>> logicsheet while translating xsp to java!
>>
>> I tried with:
>>
>>       <map:generate type="serverpages" src="test.xsp">
>>         <map:parameter name="test" value="this is test"/>
>>       </map:generate>
>>       <map:serialize type="xml"/>
>>
>> But it didn't work :-(
>>
>> Regards,
>> Marcin Okraszewski


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


Re: [XSP logicsheet] How to pass parameter to XSP logicsheet ???

Posted by Mark Leicester <ma...@energyintellect.com>.
Hi Marcin,

 From your question, I think that Oliver was on the right track with his 
suggestion that you look in the archives. Maybe these links will help 
you?

I have used this technique:
http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=105483065103410&w=2

I believe there is also a "util" logicsheet to do this (but I have 
never used it myself):
http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=106806037121755&w=2

Regards,
Mark

On 6 Feb 2004, at 21:16, Marcin Okraszewski wrote:

> I'm afraid you misunderstand me. I mean to pass parameter to 
> logicsheet while translating xsp to java!
>
> I tried with:
>
>       <map:generate type="serverpages" src="test.xsp">
>         <map:parameter name="test" value="this is test"/>
>       </map:generate>
>       <map:serialize type="xml"/>
>
> But it didn't work :-(
>
> Regards,
> Marcin Okraszewski
>
>
>> Hi Marcin,
>> This question has already been asked.
>> Take a look at the archives.
>> Quickly, use <map:parameter> in sitemap and parameters.get(...) in 
>> the XSP.
>> -- 
>> Olivier
>> On 05/02/2004 22:20, Marcin Okraszewski wrote:
>>> Hi,
>>> I need path of processed file by a XSP logicsheet (ie. XSL 
>>> transform). This could be also a request object.
>>>
>>> Normally I could pass a parameter to XSL but when it is a logicsheet 
>>> I don't know how to do it.
>>>
>>> Regards,
>>> Marcin Okraszewski
>> ---------------------------------------------------------------------
>> 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: [XSP logicsheet] How to pass parameter to XSP logicsheet ???

Posted by Marcin Okraszewski <ok...@o2.pl>.
I'm afraid you misunderstand me. I mean to pass parameter to logicsheet 
while translating xsp to java!

I tried with:

       <map:generate type="serverpages" src="test.xsp">
         <map:parameter name="test" value="this is test"/>
       </map:generate>
       <map:serialize type="xml"/>

But it didn't work :-(

Regards,
Marcin Okraszewski


> Hi Marcin,
> 
> This question has already been asked.
> Take a look at the archives.
> Quickly, use <map:parameter> in sitemap and parameters.get(...) in the XSP.
> 
> -- 
> Olivier
> 
> On 05/02/2004 22:20, Marcin Okraszewski wrote:
> 
>> Hi,
>> I need path of processed file by a XSP logicsheet (ie. XSL transform). 
>> This could be also a request object.
>>
>> Normally I could pass a parameter to XSL but when it is a logicsheet I 
>> don't know how to do it.
>>
>> Regards,
>> Marcin Okraszewski
> 
> 
> 
> ---------------------------------------------------------------------
> 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: [XSP logicsheet] How to pass parameter to XSP logicsheet ???

Posted by Olivier Billard <ob...@rennes.jouve.fr>.
Hi Marcin,

This question has already been asked.
Take a look at the archives.
Quickly, use <map:parameter> in sitemap and parameters.get(...) in the XSP.

--
Olivier

On 05/02/2004 22:20, Marcin Okraszewski wrote:

> Hi,
> I need path of processed file by a XSP logicsheet (ie. XSL transform). 
> This could be also a request object.
> 
> Normally I could pass a parameter to XSL but when it is a logicsheet I 
> don't know how to do it.
> 
> Regards,
> Marcin Okraszewski


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