ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brett Knights" <br...@knightsofthenet.com>
Subject for-each (another proposal)
Date Thu, 21 Jun 2001 16:32:16 GMT
Consider this:

<taskTransformer> <!-- as it's not just a for-each (name suggestions gratefully accepted)-->

  <elements row-elem-name="file"> <!-- this will become the xml source that will
be passed to the stylesheet -->
    <fileSet .../>
  </elements>

  <taskStyle>
  <!-- everything in here is treated as a template that would normally be defined as <xsl:template
match="/" -->
    <xsl:for-each select="file">
      <touch file="{ant:full-path(.)}"/> <!-- anticipating some ant specific extensions.
The example could use file="." -->
    </xsl:for-each>
  </taskStyle>

  <templates>
  ... <!-- optional section if further templates are required -->
  </templates>

</taskTransformer>

It's not a great deal different than each of us writing a scripted task when we want to run
over a set of files except:
 - we can still use fileSets rather than relying on our scripting language's file system access
routines.
 - any task could be used in a for-each mode without modification
 - what is produced is used as though the fully transformed version had appeared in the original
build.xml
 - the full power of xslt is available should it be needed. (and is there to bite you ...)

The task would assemble the included elements into a stylesheet that would import a standard
stylesheet (therefore any xsl:
directives in the build.xml would override the standards).

One nice thing about the xslt route is that xslt is already fully documented. :-)

There is enough work here that I won't just code it up, submit it, and see if it makes it.
If this seems viable to others and  has a
chance of making it into official Ant I'll take on developing it though. (At which time I
guess further discussions would go on the
Ant-Developer's list)

***********************************************************
Brett Knights                             250-338-3509 work
brett@KnightsOfTheNet.com                 250-334-8309 home
***********************************************************


Mime
View raw message