Christopher Oliver wrote:
Yesterday, I was trying to create another view for the flow layer, similar to a subset of JSTL, using Jexl

http://jakarta.apache.org/commons/jexl

I started with Marcus Crafter's JPathTransformer, and in the process of writing JexlTransformer, I also attempted to add support for for-each and choose/when/otherwise to JPathTransformer (both extend AbstractSAXTransformer). I also added support for expanding xpath expressions inside attribute values (similar to the way JSTL's expression language works). Oh yeah, another thing I changed is to make the continuation available as an XPath variable so you don't need jpath:continuation anymore.

Anyway, I was trying to get both of these to be equal in functionality with Velocity and the JPath Xsp logic sheet.

I've placed a copy of the source code and samples of the same template using jexl, jxpath, and velocity here:

http://www.primaryinterface.com/cocoon/transformation/

As I was doing this, I kept thinking what a poor framework AbstractSAXTransformer seemed to be (uses implementation inheritance, has protected variables with side-effects, e.g. ignoreEventsCount and ignoreHooksCount, no real API), and that a much better API for writing transformers was needed.

Just one question: why transformers?


Then I came across Volker Schmitt's taglib in the scratchpad which looks like exactly what I wanted:

http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=102227009022017&w=2

In my opinion, given the Cocoon flow layer and Cocoon's support for XSL, we don't don't need extensive tag libraries, but instead just the equivalent of a subset of JSTL core flow tags, and its expression language:

<if/>
<forEach/>
<choose/>
<out/>

aahhhhhhhhhhhhhhhhhhhhhhhhhhh!


the infamous <if/> anti-pattern: every markup language grows to include the <if/> element!

beware!

In other words, just enough to navigate through the contents of the "bean" object passed from the flow layer, in order to render output.

you have velocity and xsp that provide that functionality, why do you want another one in the transformation side? I don't understand.


This is equivalent to the functionality Ovidiu included in the jpath Xsp logic sheet.

And this is the functionality that JexlTransformer and JXPathTransformer provide, with Jexl and JXPath as the expression languages, respectively.

I would like to reimplement JexlTransformer and JXPathTransformer using taglib (if anyone want's to help, let me know).

Assuming this works, I'd also like to reimplement XMLFormTransformer using taglib and move taglib to the core as a proper API for writing transformers in the future.

Please, provide a wider context as for what you are trying to achieve and what problems you are trying to solve because it's not clear at all.


I'm not being critic, just want to know the full context because I'm not able to do any costructive criticism without one.

TIA

Stefano.




Reply via email to