On Feb 10, 2004, at 11:31 AM, Alan wrote:



What are the other possiblities for templating? Pointers appreciated.

VelocityGenerator:
http://cocoon.apache.org/2.1/userdocs/generators/velocity- generator.html


JPath logicsheet:
        http://cocoon.apache.org/2.1/userdocs/flow/jpath.html

By the way, this discussion has done much to improve my
    understanding of the problem JXTemplate and XSP address.

    Sometimes a template is a cleaner implementation than a
    transform. Cocoon needs to offer developers a way to inject
    variables into a document structure.


Lately there have been some articles on a Cocoon component for Betwixt, which is an XML Java bean serializer:
http://wiki.cocoondev.org/Wiki.jsp?page=BetwixtTransformer


I haven't played with it yet, but it seems like there's a lot of power there, because unlike the template approaches you don't have to say up front what parts of the object you want — you just say "I want this object", and then the whole thing is available (e.g. to query with Xpath expressions in your XSLT, or whatever else you want to do with it, since it's XML). It seems like it'd be trickier to implement, because the serializer has to be smart about cycles. But easy to use, I imagine.

This touches on what you said in your blog entry ("Why not just... ah, well that would probably be a pain in the butt", or something like that — you know the part I'm talking about :-). Yes, now you have the whole object... so the next thing might be to discover that this isn't so convenient after all, and we'd end up creating special-purpose Java Beans as interfaces, whose sole purpose is to be serialized into XML. At that point, we're not really better off than if we had just written a light JXTemplate to get the parts we're interested in... or if one preferred an "imperative" to a "declarative" style for this, written a little flowscript to do it. Same thing. It boils down to: somewhere, you have to specify what you want, and in the end it probably doesn't matter so much where you do it.

There's also an analogy with the Woody transformer vs. generator thread... I have a form template that really just serves as a carrier to get the widget instances into the pipeline. In the same way, you might have a JXTemplate that doesn't contain much of anything, just some minimal XML with JXPath or Jexl expressions as the element contents. In that case you might say, "to heck with the template... just give me the object!" and go with something like Betwixt.

best regards,
~ml


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to