ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject XSLT default parameters and Ant-supplied parameters conflict
Date Wed, 12 Jul 2006 17:58:12 GMT
How can I set up my build.xml file to pass Ant command-line parameters to an XSLT stylesheet
without clobbering the default values defined in the stylesheet in case a command-line parameter
is not supplied?

I have an Ant task that performs an XSLT transformation. In the stylesheet I have defined
four parameters with default values. From time to time it may be necessary to provide alternate
values for one or more of these parameters, so I have set up my build.xml file like this (relevant
section only).

<project name="hiring-reports" default="gen-report" basedir="." xmlns:ora="antlib:net.sf.incanto">

	<property name="sql.dir" value="./plsql" />
	<property name="xml.dir" value="./xml" />
	<property name="xslt.dir" value="./xslt" />
	<property name="rpts.dir" value="./rpts" />
	<property name="" value="" />
	<property name="" value="" />
	<property name="" value="" />
	<property name="" value="" />

     in = "${xml.dir}/@{infile}"
     out="${rpts.dir}/@{outfile}" processor="trax">

     <param name="weekly-end-date" expression="${}"/>
     <param name="weekly-start-date" expression="${}"/>
     <param name="cumulative-end-date" expression="${}"/>
     <param name="cumulative-start-date" expression="${}"/>

When I supply command-line parameter name and value to Ant for any of these <param>
elements, the values are passed through to the stylesheet.

On the other hand, if I fail to provide a command-line parameter name and value, Ant "seems"
to supply an empty string as the value to the stylesheet parameter. My stylesheet then replaces
the default value defined there with the empty string, causing my transformation to fail.
Charles Knell - email

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message