You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by mirko <mi...@o2.pl> on 2004/06/04 18:31:43 UTC

JXTemplate and hierarchical structure

Hi,
Is there a way to get recursive processing in JXTemplate? I need to
make hierarchical structure in the document. Or maybe I should flatten
the structure in my logic beans and then process it with simple
'for each' statement.

Regards,
mirko


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


Re[2]: JXTemplate and hierarchical structure

Posted by mirko <mi...@o2.pl>.
W Twoim liście datowanym 4 czerwca 2004 (18:38:00) można przeczytać:
UC> mirko wrote:
>> Is there a way to get recursive processing in JXTemplate? I need to
>> make hierarchical structure in the document. Or maybe I should flatten
>> the structure in my logic beans and then process it with simple
>> 'for each' statement.

UC> You can use a recursive macro:

UC> <jx:macro name="subtree">
UC>    <jx:parameter name="classes" optional="false"/>
UC>    <jx:forEach select="${classes}">
UC>      <class id="#{id}">
UC>        <name>#{name}</name>
UC>        <subtree classes="#{children}"/>
UC>      </class>
UC>    </jx:forEach>
UC> </jx:macro>

UC> <jx:forEach select="#{classes}">
UC>    <class id="#{id}">
UC>      <name>#{name}</name>
UC>      <subtree classes="#{children}"/>
UC>    </class>
UC> </jx:forEach>	

Thanks! It's what I needed.

Regards,
mirko


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


Re: JXTemplate and hierarchical structure

Posted by Ugo Cei <u....@cbim.it>.
mirko wrote:
> Is there a way to get recursive processing in JXTemplate? I need to
> make hierarchical structure in the document. Or maybe I should flatten
> the structure in my logic beans and then process it with simple
> 'for each' statement.

You can use a recursive macro:

<jx:macro name="subtree">
   <jx:parameter name="classes" optional="false"/>
   <jx:forEach select="${classes}">
     <class id="#{id}">
       <name>#{name}</name>
       <subtree classes="#{children}"/>
     </class>
   </jx:forEach>
</jx:macro>
	
<jx:forEach select="#{classes}">
   <class id="#{id}">
     <name>#{name}</name>
     <subtree classes="#{children}"/>
   </class>
</jx:forEach>	


	Ugo

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