I want to implement a <macrodef/> that can be called in two ways: With a single file parameter, or with a <fileset/>:
<macrodef name="sqlplus">
<attribute name="file"/>
<sequential>
<!-- there be dragons, here -->
</sequential>
</macrodef>
<macrodef name="sqlplus">
<element name="files"/>
<sequential>
<for param="file">
<path>
<files/>
</path>
<sequential>
<!-- call the other macro -->
<sqlplus file="@{file}"/>
</sequential>
</for>
</sequential>
</macrodef>
This doesn't seem to work. Is there any trick I can use to implement "quasi"-overloading? Or do I have to rename one of the macrodefs? I know I could write this, and check if the arguments are set (e.g. using ant-contrib):
<macrodef name="sqlplus">
<attribute name="file"/>
<element name="files" optional="yes"/>
<!-- ... -->
</macrodef>
But there is no way to make an <attribute/> optional.