As we have now two ways of calling a macro:

<root xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";>
    <jx:macro name="d">
        <jx:parameter name="p"/>
        <macroTest a="${p}">
            <jx:evalBody/>
        </macroTest>
    </jx:macro>
    <m>
        <d p="foo">
            <content b="${1+2}"/>
        </d>
    </m>
    <n>
        <jx:set var="macroName" value="d"/>
        <jx:call macro="${macroName}">
            <jx:withParam name="p" value="bar"/>
            <content b="${2+3}"/>
        </jx:call>
    </n>
</root>

what do you think about removing the old syntax in 2.2?
<d p="foo">
<content b="${1+2}"/>
</d>
For me it is counter-intuitive and leads to accidental mistakes (not so easy to find by newbies).


I also propose to remove <jx:eval/> tag as it is probably only used for:
<root xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";>
  <jx:set var="tags" value="${java.util.HashMap()}"/>
  <jx:macro name="dynamic-tag">
    <jx:parameter name="id"/>
    <jx:set var="ignored" value="${tags.put(id, macro.body)}"/>
  </jx:macro>

  <dynamic-tag id="example">
    <em>This tag was invoked dynamically</em>
  </dynamic-tag>

  <p>I'm about to invoke a dynamic tag:</p>
  <jx:eval select="${tags.example}"/>
</root>

which is clearly a hack that can be now implemented nicely with:
<root xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";>
  <jx:macro name="example">
    <em>This tag was invoked dynamically</em>
  </jx:macro>

  <p>I'm about to invoke a dynamic tag:</p>
  <jx:set var="dynamicName" value="example"/>
  <jx:call macro="${dynamicName}"/>
</root>

Moreover you can provide a body with <jx:call/> which you cannot do with <jx:eval/>

Another question:
Do you think this syntax would be useful?
<jx:call macro="${macroName}" p="bar">
    <content b="${2+3}"/>
</jx:call>

--
Leszek Gawron                                      [EMAIL PROTECTED]
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

Reply via email to