Yes, that's exactly what I needed to know. Thanks. -- Charles Knell [EMAIL PROTECTED] - email
-----Original Message----- From: Antoine Levy-Lambert <[EMAIL PROTECTED]> Sent: Wed, 12 Jul 2006 23:54:35 -0400 To: Ant Users List <user@ant.apache.org> Subject: Re: XSLT default parameters and Ant-supplied parameters conflict Hi, this line <param name="weekly-end-date" expression="${weekly.end.date}"/> means that ant will pass to the stylesheet literally ${weekly.end.date} if weekly.end.date is not set. what you would need and which does not exist would be something looking like that : <param name="weekly-end-date" expression="${weekly.end.date}" if="weekly.end.date"/> meaning pass the weekly-end-date parameter to XSL if the property weekly.end.date is set. Miracle, this construct exists, and even better in Ant 1.6.5. Regards, Antoine [EMAIL PROTECTED] wrote: > 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="weekly.start.date" value="" /> > <property name="weekly.end.date" value="" /> > <property name="cumulative.start.date" value="" /> > <property name="cumulative.end.date" value="" /> > > > <task> > <style > style="${xslt.dir}/@{stylesheet}" > in = "${xml.dir}/@{infile}" > out="${rpts.dir}/@{outfile}" processor="trax"> > > <param name="weekly-end-date" expression="${weekly.end.date}"/> > <param name="weekly-start-date" expression="${weekly.start.date}"/> > <param name="cumulative-end-date" expression="${cumulative.end.date}"/> > <param name="cumulative-start-date" > expression="${cumulative.start.date}"/> > </style> > </task> > > > 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. > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]