cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <>
Subject JXTG: invoke macro by name from expression
Date Wed, 08 Dec 2004 21:04:30 GMT
I would like to add one feature to JXTG that would allow not to promote 
hacks like [1]. Example:

<jx:macro name="fooBar">

you can only invoke it by <fooBar/>

If I were able to do <jx:invoke macro="fooBar"/> I would be able to pass 
macro name as a parameter to other macro which allows quite powerful 
data injection technique:

<jx:macro name="superPrettyPrintedTable">
   <jx:parameter name="headerTemplate"/>
   <jx:parameter name="elements"/>
   <jx:parameter name="rowTemplate"/>
   <!-- fancy code with lots of graphics here -->
       <jx:invoke macro="${headerTemplate}"/>
     <jx:forEach var="currentElement"
         <jx:invoke macro="${rowTemplate}" element="${currentElement}"/>
   <!-- fancy code with lots of graphics there -->

then use the macro like this:
<jx:macro name="addressesHeaderTemplate">
<jx:macro name="addressRowTemplate">
   <jx:parameter name="address"/>
<jx:invoke macro="superPrettyPrintedTable"

WDYT? We could deprecate jx:eval then which is not fully supported as 
additional Map structure has to be used as [1] shows.

It does not seem that much coding is needed. I could also strip all 
inner classes from JXTG at the same time as the first step for JXTG 


Leszek Gawron                            
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                    
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

View raw message