Wiki source for AntTask


Show raw source

======Calling from Ant======

xmlsh can be called from ant as a custom ant task.
The xmlsh task is defined using an the <taskdef> task.
See the ant docs on [[http://ant.apache.org/manual/develop.html Writing your Own Task]].

The <taskdef> task defines the name for the xmlsh task, the class name and the classpath to xmlsh.jar

An example of a taskdef for calling xmlsh
%%
<taskdef name="xmlsh"
classname="org.xmlsh.ant.XmlshTask"
classpath="../../bin/xmlsh-1.1.jar"/>
%%

You can then call xmlsh by using the <xmlsh> task. Xmlsh scripts can be called by filename, or by embedding the script. If calling by filename then the arguments may be specified using the <arg value="argument"/> element.

An example of calling the xmlsh script "test.xsh" passing 2 argumuments

%%
<xmlsh script="test.xsh">
<arg value="arg1"/>
<arg value="arg2"/>
</xmlsh>
%%


The xmlsh script can be passed inline as text content to the task. This should be enclosed in a CDATA section if it contains special XML charactors ( < , & ) which are common in xmlsh scripts.

A simple example with no special charactors

%%
<xmlsh>
xls
</xmlsh>
%%

An example with special charactors

%%
<xmlsh>
<![CDATA[
xslt -f xslt.xsl < file.xml > output.xml
]]>
</xmlsh>
%%
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki