Copyright © 2003 Bill de hÓra
See the licence for permissions.
0.8
Trangtask is an Ant task for the Trang RELAX NG schema conversion utility. It's based on the com.thaiopensource.relaxng.translate.Driver class.
Trangtask is currently an unstable beta. Unstable means it may change significantly before a relase version. Modifications to the code base are certain and modifications to the task syntax are likely before a stable release is shipped. You can always tell what version of trangtask you're using by looking at the 'implementation-version' property in jar manifest file .
The first stable release will be versioned 1.0
An example task:
<project name="trangtask" default="test-task" basedir=".">
<property name="eg.path" value="../lib" />
<path id="eg.classpath">
<pathelement path="${eg.path}/trangtask.jar;${eg.path}/jing.jar;${eg.path}/trang.jar" />
</path>
<target name="declare-task">
<taskdef name="trang"
classname="net.amadan.trang.ant.TrangTask"
classpathref="eg.classpath"/>
</target>
<target name="test-task" depends="declare-task">
<trang
failonerror="true"
input="input.rng" output="~output.rnc" schemaIn="rng" schemaOut="rnc">
<inputModule>
<opt name="encoding" value="UTF-8"/>
</inputModule>
<outputModule>
<opt name="encoding" value="UTF-8"/>
<opt name="indent" value="2"/>
</outputModule>
</trang>
</target>
</project>
First, the task is declared as is usual with Ant. The trang element has the following attributes
| Attribute | Description | Required |
| failonerror | fail the build if there's a problem | No |
| input | the input file/URI. | Yes |
| output | the output file/URI. | Yes |
| schemaIn | the file/URI schema type of the input. Corresponds to the Trang command line -I flag | No |
| schemaOut | the file/URI schema type of the output. Corresponds to the Trang command line -O flag | No |
and the following children:
| Element | Description | Required |
| inputModule | The input module options. Corresponds to a series of Trang command line -i flag | No |
| outputModule | The output module options. Corresponds to a series of Trang command line -o flags | No |
Each module child contains a series of opt elements, which correspond to the command line -o|i name-value pairs. The Trang manual defines the allowed options for each Input/Output Module. An opt tag is empty, and has two attributes:
| Attribute | Description | Required |
| name | the name of the option (i.e. 'encoding'). | Yes |
| value | The value of the option. | Yes |
Aside from Ant, trangtask depends on the following:
Dependencies are shipped in the binary distribution.
Assuming you have Ant and a JDK1.3+ set up, everything you need to build trangtask can be had by unpacking the source distribution. All dependencies ship with it and are declared in the file 'cp.properties' in the project top level. If you do not use the $JAVA_ROOT idiom, you may need to change some properties in cp.properties or add this envar to your system.