| <project> |
| |
| <target name="simple"> |
| <macrodef name="my.echo"> |
| <attribute name="text"/> |
| <sequential> |
| <echo message="@{text}"/> |
| </sequential> |
| </macrodef> |
| <my.echo text="Hello World"/> |
| </target> |
| |
| <target name="text"> |
| <macrodef name="my.echo"> |
| <attribute name="text"/> |
| <sequential> |
| <echo>@{text}</echo> |
| </sequential> |
| </macrodef> |
| <my.echo text="Inner Text"/> |
| </target> |
| |
| <target name="duplicate.attribute"> |
| <macrodef name="my.echo"> |
| <attribute name="text"/> |
| <attribute name="text"/> |
| <sequential> |
| <echo>@{text}</echo> |
| </sequential> |
| </macrodef> |
| </target> |
| |
| <target name="duplicate.element"> |
| <macrodef name="my.echo"> |
| <element name="text"/> |
| <element name="text"/> |
| <sequential> |
| <text/> |
| </sequential> |
| </macrodef> |
| </target> |
| |
| <target name="uri"> |
| <macrodef name="echo" uri="abc"> |
| <attribute name="text"/> |
| <sequential> |
| <echo message="@{text}"/> |
| </sequential> |
| </macrodef> |
| <x:echo xmlns:x="abc" text="Hello World"/> |
| </target> |
| |
| <target name="nested"> |
| <macrodef name="nested"> |
| <element name="nested"/> |
| <sequential> |
| <nested/> |
| </sequential> |
| </macrodef> |
| |
| <nested> |
| <nested> |
| <echo>A nested element</echo> |
| </nested> |
| </nested> |
| </target> |
| |
| <target name="double"> |
| <macrodef name="double"> |
| <attribute name="prop"/> |
| <sequential> |
| <echo>@@{prop} is '@{prop}', value of $${@{prop}} is '${@{prop}}'</echo> |
| </sequential> |
| </macrodef> |
| <property name="property" value="A property value"/> |
| <double prop="property"/> |
| </target> |
| </project> |