cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Oliver <>
Subject Woody template transformer using jx macros
Date Sun, 04 Jan 2004 07:03:01 GMT
Attached is a first attempt to implement the behavior of the Woody 
template transformer with the macro facility of the JXTemplateGenerator. 
I'm not sure whether it's a hack or a design pattern, but since the 
Woody widgets know how to emit themselves onto a ContentHandler, the 
only real change I had to make to JXTemplateGenerator was to expose its 
xmlConsumer as a template variable (namely cocoon.consumer).

At first glance, these macros may seem a bit complex, but I think you'll 
find the attached is actually quite a bit simpler than 
WoodyTemplateTransformer. The additional benefit is that you also have 
the full power of  JXTemplate's in your Woody form templates (expression 
substitution, flow control, etc).

To use these macros, in your sitemap replace

  <generate src="blah.xml">
  <transform type="woody">

   <generate type="jx" src="blah.xml">

and modify your form template to import the jx template containing the 
macros, e.g:

<page xmlns:wt=""

  <jx:import uri="forms/woody.jx"/>

  <title>Sample form</title>
    <wt:form-template action="#{$continuation/id}.continue" method="POST">

Let me know what you think.



View raw message