[Yanel-usage] Recursion in jelly templates

Cedric Staub cedric.staub at wyona.com
Thu Feb 10 22:43:53 CET 2011


Hello Bilgin

On Thu, Feb 10, 2011 at 05:53:57PM +0000, Bilgin Ibryam wrote:
> I'd like to display a tree structure using jelly templates, but can't find a
> way to iterate over all the nodes w/o doing recursive calls.
> Any ideas how can I display tree structure or do recursive calls in jelly (I
> checked the jelly tutorial but couldn't find anything useful there)?

As far as I know both Jelly and XSLT are functional languages (not sure 
about Jelly, but XSLT is certainly purely functional). This means that
you will have to use recursion to print your tree, since functional
languages can't have mutable state.

That said, I never actually used Jelly in this fashion (I prefer XSLT
over Jelly). But if I understand the Jelly documentation correctly, you
should be able to use the template/applyTemplates tags to define and
recursively apply templates.

See here: https://commons.apache.org/jelly/libs/jsl/tags.html

Cheers,
Cedric


More information about the Yanel-usage mailing list