cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Foster <jafos...@engmail.uwaterloo.ca>
Subject [C2] ScriptGenerator
Date Sun, 04 Mar 2001 20:39:28 GMT
I've put together a small generator that I would like to contribute to the
Cocoon2 project.  This generator uses the BSF framework to allow developers
to generate their XML using Python, JavaScript, etc.

Using the generator is as easy as adding the following to the sitemap:

<map:generator
     name="script"
     src="org.apache.cocoon.generation.ScriptGenerator"/>

<map:match pattern="scripts/*">
 <map:generate type="script" src="docs/samples/{1}"/>
 <map:transform src="stylesheets/page/simple-page2html.xsl"/>
 <map:serialize type="html"/>
</map:match>

Within your script you have access to all of the generator objects that
looked interesting, including the Cocoon Logger.  XML is passed from the
script to Cocoon using a StringBuffer named "output".  Check out the
examples for more details.

Cocoon2 already includes the Rhino JavaScript interpreter, so .js files will
work immediately.  You can get the Jython interpreter at www.jython.org, and
hopefully jython.jar will make it into the Cocoon2 distribution.

What I think might be interesting is that there is some early support for
Perl in the BSF.  This might allow an elegant transition from Perl/CGI sites
to Cocoon sites.

I have attached a .tar.gz with the code.  Any comments on the code, style,
approach, etc. would be greatly appreciated.

Jason Foster


Mime
View raw message