Altova Mailing List Archives>Archive Index >xsl-list Archive Home >Recent entries >Thread Prev - >Thread Next - Re: [xsl] Removing dead targets from Ant build files RE: [xsl] Removing dead targets from Ant build filesTo: Date: 1/2/2008 10:23:00 AM Many thanks Peter,
I have extended your solution very slightly.
Here it is:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xsl">
<xsl:output method="xml" encoding="utf-8"/>
<xsl:template match="/project | description | comment()">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates></xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="target">
<xsl:variable name="name" select="@name"></xsl:variable>
<xsl:if test="//target[contains(@depends,$name)] or
/project[@default=$name] or boolean(@description)"><xsl:copy-of
select="."/></xsl:if>
</xsl:template>
<xsl:template match="*">
<xsl:message terminate="yes">
<xsl:value-of select="concat('Unhandled tag=',name())"></xsl:value-of>
</xsl:message>
</xsl:template>
</xsl:stylesheet>
Happy New Year everybody,
Graham | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
