cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <>
Subject Re: JXTemplates+Flow vs Generator+XSLT
Date Wed, 22 Mar 2006 14:37:59 GMT
Nacho Jimenez wrote:
> Hi all,
> I'm implementing a website and was wondering which of the two ways
> (JXT+Flow vs  Generator+XSLT) was better suited to my customer.
> My data is in a database, and I 'm used to a mix and match approach: I
> use JXT+Flow for web applications (low number of users  but stronger
> requirements) and custom written generators + xslt  for public web
> (high number of users, simple data access), but i was wondering what's
> the difference performance wise (speed, caching, etc). Development of
> JXtemplate is easier, since i already have a plain HTML prototype of
> the web.
> I have two possible scenarios. In both, each different uri maps
> univocally to a document (always has the same output) , so caching is
> important:
> Scenario 1: The data is in a XMLDB
> Option JXT+Flow: Doesn't make sense,as I'd have to make a DOM of the
> document before throwing it to the pipeline (Any idea of an easier way
> to do it with JXTempate?)
> Option Gen+XSLT: There's no need for the generator, i'd use a file
> generator with xmldb source  protocol and transform it to get the
> final HTML.

Looks like the choice is clear there. :-)

> Scenario 2: The data is in a SQLDB
> Option JXT+Flow: I call a java package to get the data, and throw the
> data as a parameter to a JXTemplate Generator pipeline.
> Option Gen+XSLT:  I write my own generator (using a XSP generator as a
> prototype) and parse it with an XSLT transformer to get the final
> Any comments?

I think the difference between your two options is less than you think.
 JXTemplate is really just a tool that makes it easier for you to create
your own generator.  In both options you have code that (1) retrieves
your source data and (2) inserts that data into an XML event stream.
The only difference is where (1) and (2) occur; in the custom Generator
they both happen in the Generator java class, whereas in JXT+Flow (1)
happens in flow and (2) happens in JXT.

I believe the real difference for you is cacheability.  If you write
your own Generator class you can make it cacheable by implementing
CacheableProcessingComponent.  With JXT it is not so simple.  First of
all I think you would need to wait for 2.1.9 and the new JX generator
provided in the template block (somebody correct me if this is already
in 2.1.8); that version of JXT allows jx:cache-key and jx:cache-validity
attributes to specify the cacheability of your template.  But if your
flowscript has to run business logic before calling the template, that
is a problem since only the JX generator knows about the cache validity,
so you would potentially be running the expensive part (the SQL query)
before JX evaluates the cache validity.  There is a technique to get
around that though, described at the very bottom of

In my opinion JX+Flow is the clear choice for interactive web apps where
cacheability is not a concern, whereas custom Generators (or custom
Source implementations) are still the best fit for pure publishing,
though JX is improving in that area as well.

Hope that's of some help to you

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message