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

Subject: RE: [xsl] Removing dead targets from Ant build files
From: "Hofman, Peter" <peter.hofman@xxxxxxxxxxxxx>
Date: Fri, 21 Dec 2007 10:05:41 +0100
Hi Graham and all other xsl-list contributors,

To only remove targets not listed in depends attributes (or project
default attribute),
it looks something like this (xsl 1.0):

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
<xsl:output method="xml" indent="yes" encoding="utf-8"/>
<xsl:template match="/project">
<xsl:template match="target">
  <xsl:variable name="name" select="@name"/>
  <xsl:if test="//target[contains(@depends,$name)] or
    <xsl:copy-of select="."/>

I tested it with some very simple ant build files, using the msxsl
This will remove any target that is not listed in either
/project/@default or any //target/@depends.
IIRC ant complains if some target/@depends contains a non existing
so I didn't bother cleaning up the target/@depends.

Breaking up large build files into smaller ones is something completely
I would do that in XSLT 2.0 anyway using xsl:result-document.


>-----Original Message-----
>From: Heath, Graham [mailto:Graham.Heath@xxxxxxxxxxxxxxxxxxx]
>Sent: vrijdag 21 december 2007 8:45
>To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>Subject: [xsl] Removing dead targets from Ant build files
>Does anyone out there have a stylesheet that parses and trims
>dead targets from ant build files?
>I started writing a stylesheet to do this but it got very
>convoluted and never acheived what I wanted so I gave up.
>Currently we use Saxon 6.53 (becuase of DocBook).
>I am also convinced that other people must also have large
>unwieldy ant files that over time have collected a bunch of
>dead targets (ones that do not appear in depends="" lists and
>do not have a description attribute).
>Thanks for any ideas, hints, or stylesheets. There is, of
>course, the related issue of chunking these build files by
>following dependancies from distinct targets to build
>"feature" related build files, that are smaller and more manageable.

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an intended
recipient then please promptly delete this e-mail and any attachment and all
copies and inform the sender. Thank you.

Current Thread