cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <va...@reverycodes.com>
Subject Re: How to inject the result of an action into a generator
Date Tue, 25 Mar 2008 18:07:57 GMT
On Mar 25, 2008, at 11:15 AM, shai200 wrote:
>
> But I want the generator to take the XML output of my action and use  
> that as
> the text to pass down, and not read a file or a servlet.
>
> How do I do that?

Action should not be used to create whole XML content for the  
generator. In this situation, you could use any of following approaches:

1. Action returns name of the source to use by generator:

   <!-- Action which picks what source to use. Returns 'source'  
parameter with URL -->
   <map:act type="pick-a-source">
     <map:generate src="{source}"/>
   </map:act>


2. Instead of Action, implement a Generator and use it:

   <!-- Call your 'xml-generation' generator which produces XML -->
   <map:generate type="xml-generation"/>


3. Alternatively, implement a Source and use it:

   <!-- Standard file generator accesses XML generated by your 'xml- 
source' protocol -->
   <map:generate src="xml-source:"/>


4. Check if any of existing input modules and/or sources provide the  
needed functionality (probably by using XModuleSource, even though  
previous 3 approaches are better)


Vadim


> Vadim Gritsenko wrote:
>>
>> On Mar 25, 2008, at 12:31 AM, shai200 wrote:
>>>
>>> This doesn't work for me for some reason. I get an error (see end of
>>> this
>>> message).
>>
>> <snip/>
>>
>>> And my sitemap entry is:
>>>
>>> 	<map:match pattern="xmlaction">
>>> 			<map:act type="xml-injection">
>>> 				 <map:generate>
>>>    			             <map:parameter name="param"
>>> value="{paramAction}"/>
>>>  				</map:generate>
>>
>> Generator must have src attribute pointing to source document it
>> should use. For example, following would work:
>>
>>   <map:generate type="jx" src="pages/result.jx">
>>     <map:parameter name="param" value="{paramAction}"/>
>>   </map:generate>
>>
>>
>> Vadim
>>

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


Mime
View raw message