Thanks! The flowscript now works perfectly!
(I still have to check the Action.)

The final flowscript code was as follows (Just in case anyone else
wants to read this later...)

function getResource() {
var input = Packages.java.lang.String(cocoon.parameters["input"]);

var output = new Packages.java.io.ByteArrayOutputStream();
cocoon.processPipelineTo("flow/locateimage/"+input,null,output);
var realFileName = output.toString();

cocoon.sendPage("flow/readimage/"+realFileName);
}

In the sitemap, I got:
        <map:flow language="javascript">
                <map:script src="flowscript/shapeshifter.flow"/>
        </map:flow>

This is the first step, that matches my image:
       <map:match pattern="images/**.jpg">
               <map:call function="getResource">
                   <map:parameter name="input" value="{1}.jpg"/>
                </map:call>
       </map:match>

This is the second step, that finds the real file name:
     <map:match pattern="flow/locateimage/**.jpg">
             <map:generate src="xq/resource.xq" type="xquery">
                   <map:parameter name="input" value="{1}.jpg"/>
             </map:generate>
             <map:serialize type="text"/>
     </map:match>

This is the final step, that reads the image from eXist:
        <map:match pattern="flow/readimage/**.jpg">
             <map:read type="image"
src="http://guest:[EMAIL PROTECTED]:8080/cocoon/webdav/db/contents/jpeg/{1}.jpg"
mime-type="text/jpg "/>
        </map:match>

As a test case, I have used an empty xQuery, just returning the parameter:

xquery version "1.0";
declare namespace request="http://exist-db.org/xquery/request";;
declare namespace xmldb="http://exist-db.org/xquery/xmldb";;
declare namespace xi="http://www.w3.org/2001/XInclude";;
<data>{$input}</data>

Hans

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to