Re: [xsl] Removing dead targets from Ant build files

Subject: Re: [xsl] Removing dead targets from Ant build files
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Wed, 02 Jan 2008 22:14:42 +0100
Heath, Graham wrote:
<xsl:if test="//target[contains(@depends,$name)]

Note that this will also find a target named "compile" in a dependency list containing "compile-stuff". IIRC ant target dependency lists contain comma separated, optionally whitespace surrounded values. Therefore a more exact approach is to kill whitespace in the dependency list and surround everything by guarding commas, somewhat like: test="//target[contains( concat(',',translate(@depends,' &#xA',''),','), concat(',',$name,',')]

You may run into performance problems for large
ant files, but reformulating this search using keys
should solve these.

It is quite possible that ant target names are also
whitespace trimmed by ant, which would mean you have
to do the same in the XSLT also. Please refer to the
ant docs for further details.

J.Pietschmann

Current Thread