You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Nacho Jimenez <na...@gmail.com> on 2006/03/22 12:26:48 UTC

JXTemplates+Flow vs Generator+XSLT

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.

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
HTML.

Any comments?

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


Re: JXTemplates+Flow vs Generator+XSLT

Posted by ia...@jpmchase.com.
A third option, if you are only using Flow to initialize a data object then
pass it to your JXTemplate, is the use of custom actions.  This has the
advantage of achieving the same results as Flow without the overhead of
increased complexity (IMO) and the concurrency issue.

Also note that JXTemplate and XSLT are not mutually exclusive.  There is
absolutely nothing preventing you from including an XSLT transform within a
match containing a JX generator.


HTH,
Ian

It's better to be hated for who you are
than loved for who you are not

Ian D. Stewart
Appl Dev Analyst-Advisory, DCS Automation
JPMorganChase Global Technology Infrastructure
Phone: (614) 244-2564
Pager: (888) 260-0078


                                                                                                                                       
                      Jason Johnston                                                                                                   
                      <cocoon@lojjic.ne        To:       users@cocoon.apache.org                                                       
                      t>                       cc:                                                                                     
                                               Subject:  Re: JXTemplates+Flow vs Generator+XSLT                                        
                      03/22/2006 09:37                                                                                                 
                      AM                                                                                                               
                      Please respond to                                                                                                
                      users                                                                                                            
                                                                                                                                       




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
> HTML.
>
> 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
http://wiki.apache.org/cocoon/JXTemplateGenerator.

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
--Jason


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




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


Re: JXTemplates+Flow vs Generator+XSLT

Posted by Jason Johnston <co...@lojjic.net>.
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
> HTML.
> 
> 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
http://wiki.apache.org/cocoon/JXTemplateGenerator.

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
--Jason


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