A little off-topic, but could you point me to some info on how you can merge
two xml files to produce a third using an xslt stylesheet?

In either Myrmidon's templating system using xslt, or 'Java and XSLT' book,
the xslt stylesheet *contains* the xml template as well. If I remember
correctly, you pointed out a while ago that it didn't separate the the ANT
build template and the stylesheet, which I agree with. It also requires to
know xslt to update the template, which is bad.

Please forgive my ignorance of XSLT related matter ;-) --DD

-----Original Message-----
From: Wannheden, Knut [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, May 23, 2002 3:04 AM
To: 'Ant Users List'
Subject: RE: changing the main initialization procedure

> 
> Peter Donald (have to use full name because this list is 
> soooo full ;) , any
> hint on how to include a basic templating mechanism with current Ant?
> I recall you favor templating, and I'm sure you can help us 
> (I'm interested
> too) and give us some advice.
> 

Just to briefly describe how I've implemented my templates: I have a
template buildfile (regular Ant buildfile) with some common (or default)
targets, paths, properties, etc.  Then for every "real" project I merge
(with XSLT) this template with another customization (also an Ant buildfile)
which overrides definitions in the template.  This works like a simple
inheritance mechanism.  So I could have a template like:

<project name="template" default="compile">

 <property name="source-dir" value="src"/>
 <property name="build-dir" value="build"/>

 <target name="init"/>
 <target name="compile" depends="init">
  <javac srcdir="${source-dir}" destdir="${build-dir}"/>
 </target>

</project>

and a customization for a project (notice the additional <super/> in target
compile):

<project name="custom">

 <property name="build-dir" value="classes"/>

 <target name="idlj">
  <exec/>
 </target>

 <target name="compile" depends="init,idlj">
  <super/>
 </target>

</project>

which would be merged into:

<project name="custom" default="compile">

 <property name="source-dir" value="src"/>
 <property name="build-dir" value="classes"/>

 <target name="init"/>

 <target name="idlj">
  <exec/>
 </target>

 <target name="compile" depends="init,idlj">
  <javac srcdir="${source-dir}" destdir="${build-dir}"/>
 </target>

</project>

I found this to work quite nicely.  I added the <super> target because I
wanted as few changes as possible in the template to cause manual changes to
be made to the customization.

--
knut

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to