xsl-list
[Top] [All Lists]

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

2008-01-02 03:23:26
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[(_at_)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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>