:o) thx to Yatin Shah and his post here:
http://www.mail-archive.com/dev@cocoon.apache.org/msg11753.html

my problem is solved.
maybe someone puts this in the wiki??

gn8 everyone

----floscript---------------------------------------------------------------------
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();
}
----sitemap----------------------------------------------------------------------
<!-- ==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:transform>
               <map:serialize type="xml" />
         </map:match>
----stylesheet------------------------------------------------------------------
<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="/">
    <enriched>
        <URL><xsl:value-of select="$url"/></URL>
        <URN><xsl:value-of select="$urn"/></URN>
        <xsl:copy-of select="/"/>
    </enriched>
  </xsl:template>
</xsl:stylesheet>

Jan Hinzmann wrote:
Hi cocooners
Consider the following
I have a webapp, where the user can upload a xmlfile (called 'uploadfile') and enter a url (called 'uploadurl') the webapp then transforms the uploaded xmlfile and enriches it with the url and a computed value 'urn' (calculated in a flowscript).
after the flowscript is ready it calles


'cocoon.processPipelineTo("myPipeline, valueToBeAdded, streamToGetTheResultOfTheTransformation);'

But I dont get the point, how to access my passed parameter in the pipeline?
plz help me out. thanks


flowscript:
...
function enricheXML(urnforthexml){
    var enrichedXML = java.io.ByteArrayOutputStream();
    cocoon.processPipelineTo("enricheXML", urnForTheXml, enrichedXML);
    return enrichedXML.toString();
}
...

and the sitemap:
...
<!-- ==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}" />


<!-- how do i access the parameter passed from the flowscript? -->
<map:parameter name="urn" value="{request-param:urn}" />


               </map:transform>
               <map:serialize type="xml" />
         </map:match>

...

the enrichement.xsl is :
...
<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="/">
    <enriched>
    <URL><xsl:value-of select="$url"/></URL>
    <URN><xsl:value-of select="$urn"/></URN>
    </enriched>
  </xsl:template>

</xsl:stylesheet>
...

-- Gruss Jan Hinzmann

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



Reply via email to