cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jorg Heymans ...@domek.be>
Subject Re: how to use a CInclude template to include resources
Date Fri, 27 Aug 2004 13:39:56 GMT


Norman Barker wrote:

> Hi,
> 
> I am rephrasing this to be clearer, thanks Derek.
> 
> I have set up several pipelines and readers within cocoon.
> I can include XML content without any problems using a CInclude template,
> as in the following example (not the real code, just dummy names).
> 
> <data xmlns:cinclude="http://apache.org/cocoon/include/1.0">
>    <MyCollection1>
>        <cinclude:include src="cocoon:/test1" element="data1"/>
>    </MyCollection1>
>    <MyCollection2>
>        <cinclude:include src="cocoon:/test2" element="data2"/>
>    </MyCollection2>
> </data>
> 
> so cocoon:/test1 returns XML and this fits in nicely.
> 
> however when I want to include image content within the template I would 
> like to
> do either of the two things below as in the case of cocoon:/test2 being 
> a reader;
> 
> 1) Save the image returned from the reader in a temporary location that 
> is cleaned
> by Cocoon after the request and a URL to this resouces is stored in the 
> XML (an
> example of this would help me alot)
This sounds like something flow could do.
so you cinclude:include src="cocoon:/pipelineWithMyFlowFunction" instead 
of cocoon:/test1.
In this flow function you generate your image and write it to a 
temporary file (using processPipelineTo), you then return your file 
identifier so it gets included in the document.


> 
> 2) store a BaseBinary64 version of this image in the XML, or just the 
> pixel values
modify your reader to spit out base64 seems the easiest thing to do here.

> 
> Finally, is I post an XML document to Cocoon which looks like for example
> <root>
>   <request1>...</request1>
>    <request2>...<request2>
> </root>
> 
> is there a generator that will iterate over this document and make each 
> of the requests, or do
> I have to write a custom generator? I don't expect the user to make 
> multiple requests to the
> server, just to wrap up all the requests in one go and send them to the 
> server.  So can I iterate
> over this?
If this iteration definition needs to come from the outside world then 
you could write an xsl that transforms
<root>
   <req1></req1>
   <req2></req2>
...
into
<mycollection>
   <cinclude:include src="the contents of element req1"/>
   <cinclude:include src=cocoon:/"the contents of element req2"/>
</mycollection>
and then have the cinclude transform do it's work.


HTH
Jorg


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


Mime
View raw message