cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rui Alberto L." Gonçalves <rui-l-goncal...@ptinovacao.pt>
Subject Re: Writing files with cocoon
Date Fri, 03 Sep 2004 18:32:37 GMT
Hi David,
you can do this in various ways, I'm presenting to simple options.

Using velocity... See documentation/examples how to write
the velocity template. Just checking examples you can solve
your problem.

sitemap.xmap
<map:match pattern="form_action">
 <map:generate type="velocity" src="produce_doc.vm/>
 <map:transform type="xmldb"/>
 <map:serialize type="xml"/>
</map:match>

If you just want to use xslt... 

sitemap.xmap
<map:match pattern="form_action">
 <map:generate src="dummy.xml"/>
 <map:transform src="your_style_to_produce_xml.xsl">
  <map:parameter name="use-request-parameters" value="true"/>
 </map:transform>
 <map:transform type="xmldb"/>
 <map:serialize type="xml"/>
</map:match>

dummy.xml is a file used just to start the pipeline with a 
generator. (this is not a really clean solution, but... :)
This file could be something like <root></root>
Then in your stylesheet have something like:

<xsl:stylesheet ...

  <xsl:param name="form_parameter1"/>
  <xsl:param name="form_parameter2"/>
  <xsl:template match="root">
   ... <!--
produce xml to xmldb transformer using
parameter values found in request.

  </xsl:template>
/xsl:stylesheet>

Hope this helps.

Rui




On Fri, 2004-09-03 at 16:56, David Verdin wrote:
> Hi everybody,
> 
> I'm currently trying to write the result of a form filling to a file.
> I could understand how to handle this filling and to pass it to a
> sitemap.
> 
> My problem is now to be able to write this to a file, created
> dynamically.
> The final aim is to update a Xindice database. I know there are some
> wikis to understand how to use Xindice with XMLforms in Cocoon, but as
> there is no longer support of XMLforms in Cocoon 2.1, I'm trying to
> achieve my own implementation.
> 
> The problem is that I am *really* bad at Java, or even Javascript
> coding. So I try to use XSLT.
> My idea is to use an XSLT transformation to create an XML document in
> Cocoon, and then write this to a file. Is this possible ?
> 
> Cheers,
> 
> David
> -- 
> ************************************
> David Verdin
> GES / ENSAR - laboratoire d'informatique
> 65, rue de St Brieuc
> CS 84 215
> 35 042 Rennes cedex
> e-mail : verdin@lilas.roazhon.inra.fr
> tél : 02 23 48 54 58
> fax : 02 23 48 54 50
> ************************************
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For
> additional commands, e-mail: users-help@cocoon.apache.org
-- 
Rui Alberto L. Gonçalves <rui-l-goncalves@ptinovacao.pt>
PT Inovação


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


Mime
View raw message