Future home of some really good FlowScript docs

The J!PathTransformer seems like the ideal thing to use in many cases. -- TonyCollen

See also

or get these all as one printable page

You can also split up your flow code like so:

<map:flow language="JavaScript">
    <map:script src="script1.js"/>
    <map:script src="script2.js"/>
    <map:script src="script3.js"/>
    <map:script src="script4.js"/>

Q: What Cocoon-specific objects are available in the Flow?

A: Interface to various Cocoon abstractions:

The info regarding how the flow functions were named (using js*) in Rhino has been retired. Check the Wiki diffs if you still need this info, but you probably won't. -- TonyCollen

Q: How do I pass flowscript parameters to the sitemap?

A: Accessing flowscript parameters in the sitemap:

You create an object of class PipelineUtil and pass the parameters to this object along with the match pattern of the pipeline. Or you pass the parameters to cocoon.sendPage or cocoon.sendPageAndWait.

In the pipeline you access the parameter using <map:parameter name="flowparameter" value="{flow-attribute:urn}"/>

Here is an example:


function enricheXML(urnforthexml){
   var enrichedXML = java.io.ByteArrayOutputStream();
   var pipeutil = cocoon.createObject(Packages.org.apache.cocoon.components.flow.util.PipelineUtil);
   pipeutil.processToStream("enricheXML", {"urn":urnforthexml}, enrichedXML);
   return enrichedXML.toString();


<!-- ==Pattern for the XMLenrichement ====================================== -->
   <map:match pattern="enricheXML">
      <map:generate src="{request-param:uploadfile}" />
      <map:transform src="xsl/enrichement.xsl" >
         <map:parameter name="url" value="{request-param:uploadurl}" />
         <map:parameter name="urn" value="{flow-attribute:urn}" />
      <map:serialize type="xml" />


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:output method="xml"/>
   <xsl:param name="urn" />
   <xsl:param name="url" />

   <xsl:template match="/">
         <URL><xsl:value-of select="$url"/></URL>
         <URN><xsl:value-of select="$urn"/></URN>
         <xsl:copy-of select="/"/>

Thanks to JanHinzmann

Flow (last edited 2009-09-20 23:40:14 by localhost)