You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Walter Lewis <le...@hhpl.on.ca> on 2007/01/16 19:43:57 UTC

Exiting flowscript by sending XML to a pipeline

My thanks to Jason for the keys to the regular expression kingdom, or at 
least that part solvable by type conversion.  :)

Now that the data is being manipulated in flowscript to my satisfaction 
(or, at least, well enough for the moment),  on to the next question:
    How to exit flowscript and pass the output into another (or 
containing) pipeline expecting XML.

I have a public pipeline that includes this match:

    <map:match pattern="results">
        <map:call function="main"/>
        <map:transform type="cinclude" />
        <map:serialize type="xml"/>
    </map:match>

with  an internal pipeline for the flowscript:
<map:pipeline>
      <map:match pattern="style/QueryValues">
        <map:generate type="jx" src="style/QueryValues.xsl"/>
        <map:serialize type="xml"/>
      </map:match>
    </map:pipeline>

the flowscript is defined here:
<map:flow language="javascript">
  <map:script src="flow/search.js"/>
</map:flow>

search.js main() ends with
   
    cocoon.sendPage("style/QueryValues",
        {
            "q" : q,
            "fullQuery" : fullQuery,
    [and a number of other values in the same pattern]
        }

The whole object of the flowscript is to manipulate the q value into the 
fullQuery value using javascript/rhino before passing it into a url that 
I want to <cinclude> in the results pipeline.

Those of you who have followed me to this point will probably not be 
surprised that what is returned to screen is the QueryValues output, 
without the further processing in the "results" pipeline.  If I *don't 
serialize it within the QueryValues pipeline I have a "No pipeline 
matched request" error.

The examples seem to assume that the flowscript sendPage is going 
directly back to the user as HTML (obviously the key use case). I'm 
missing the examples where it isn't.

I see that Rajesh Aravindakshan posed a similar question in Feb 2005, 
but I couldn't pull up a thread where the answer is resolved.

Walter

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


Re: Exiting flowscript by sending XML to a pipeline

Posted by Tony Edwards <an...@optusnet.com.au>.
I wrote a little item for the wiki a while back wherein I create and 
manipulate a dom document in flowscript then send the dom back to the 
sitemap for presentation.
Hop onto the wiki and do a search for:
FlowBasedXMLEditor 
<http://wiki.apache.org/cocoon/FlowBasedXMLEditor?action=fullsearch&value=linkto%3A%22FlowBasedXMLEditor%22&context=180>
If its not detailed enough (I wrote it a while back) let me know.

Hope this helps!
Regards
Tony

Mark Lundquist wrote:
>
>
> On Jan 16, 2007, at 10:43 AM, Walter Lewis wrote:
>
>     My thanks to Jason for the keys to the regular expression kingdom,
>     or at least that part solvable by type conversion. :)
>
>     Now that the data is being manipulated in flowscript to my
>     satisfaction (or, at least, well enough for the moment), on to the
>     next question:
>     How to exit flowscript and pass the output into another (or
>     containing) pipeline expecting XML.
>
>     I have a public pipeline that includes this match:
>
>     <map:match pattern="results">
>     <map:call function="main"/>
>     <map:transform type="cinclude" />
>     <map:serialize type="xml"/>
>     </map:match>
>
>
> OK, that's going to have to change. Once your pipeline calls a 
> flowscript function, it is /done/. There must be more processing to 
> eventuate in a reply to the client, but that will take place in other 
> pipeline(s).
>
> You could put your cinclude transformer into the pipeline that has the 
> jx generator. Or, you could put the <map:call> into another pipeline 
> and call it (<generate src="cocoon:/whatever") from the "results" 
> pipeline.
>
> HTH,
> —ml—
>


This email is from Civica Pty Limited and it, together with any 
attachments, is confidential to the intended recipient(s) and the 
contents may be legally privileged or contain proprietary and 
private information. It is intended solely for the person to whom 
it is addressed. If you are not an intended recipient, you may 
not 
review, copy or distribute this email. If received in error, 
please 
notify the sender and delete the message from your system 
immediately. Any views or opinions expressed in this email and 
any 
files transmitted with it are those of the author only and may 
not 
necessarily reflect the views of Civica and do not create any 
legally binding rights or obligations whatsoever. Unless 
otherwise 
pre-agreed by exchange of hard copy documents signed by duly 
authorised representatives, contracts may not be concluded on 
behalf of Civica by email. Please note that neither Civica nor 
the 
sender accepts any responsibility for any viruses and it is your 
responsibility to scan the email and the attachments (if any). 
All 
email received and sent by Civica may be monitored to protect the 
business interests of Civica. 


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


Re: Exiting flowscript by sending XML to a pipeline

Posted by Mark Lundquist <lu...@gmail.com>.
On Jan 16, 2007, at 10:43 AM, Walter Lewis wrote:

> My thanks to Jason for the keys to the regular expression kingdom, or 
> at least that part solvable by type conversion.  :)
>
> Now that the data is being manipulated in flowscript to my 
> satisfaction (or, at least, well enough for the moment),  on to the 
> next question:
>    How to exit flowscript and pass the output into another (or 
> containing) pipeline expecting XML.
>
> I have a public pipeline that includes this match:
>
>    <map:match pattern="results">
>        <map:call function="main"/>
>        <map:transform type="cinclude" />
>        <map:serialize type="xml"/>
>    </map:match>

OK, that's going to have to change.  Once your pipeline calls a 
flowscript function, it is done.  There must be more processing to 
eventuate in a reply to the client, but that will take place in other 
pipeline(s).

You could put your cinclude transformer into the pipeline that has the 
jx generator.  Or, you could put the <map:call> into another pipeline 
and call it (<generate src="cocoon:/whatever") from the "results" 
pipeline.

HTH,
—ml—