Bug 57112

Summary: <macrodef>: ability to transform a nested element
Product: Ant Reporter: Matthew Cline <matt>
Component: Core tasksAssignee: Ant Notifications List <notifications>
Status: NEW ---    
Severity: enhancement    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Matthew Cline 2014-10-18 04:58:35 UTC
In a <macrodef>, I'd like to be able to take the text and attributes of a nested element, and use it to construct something entirely different.  A simple example of what I'm thinking about:

    <macrodef name="transform_demo">
        <transformed_element name="foo" optional="yes"/>
        <sequential>
            <foo><echo message="@{foo.text}"/></foo>
        </sequential>
    </macrodef>
 
A usage:

    <transform_demo>
        <foo>A</foo>
        <foo>B</foo>
        <foo>C</foo>
    </transform_demo>

The result:

    <echo message="A"/>
    <echo message="B"/>
    <echo message="C"/>