ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <>
Subject Re: RE: Setting the value of a property conditonally
Date Fri, 04 Aug 2006 13:59:16 GMT
> I'm faced with a situation that calls for me to select the previous "business day". In
the U.S. business days are generally Mon, Tue, Wed, Thu, Fri, with Saturday and Sunday not
usually counted.
> On most days of the week, the previous business day is the current date - 1 day. On Monday
however, the previous business day is the current date - 3 days.
> Federal holidays complicate the matter further. In the U.S. most federal holidays are
observed on Mondays. Therefore, on a Tuesday following a Monday that is a federal holiday,
the previous business day is the current date - 4 days.
> Some federal holidays do occur on other days, so on days following one of these, the
previous business day is the current date - 2 days (unless, of course, the federal holiday
falls on a non-business day).
> This is all fairly easily handled in XSLT using the <xsl:choose> element and a
list of the dates on which federal holidays are observed.
> I have worked out an alternative plan that calls for using the <xslt> task to process
the file containing the list of federal holidays and create a new XML file holding the data
I want. I could then use the <xmlproperty> element to set the values of the properties.
> I don't really want to create an intermediate file to perform this task, so I'm asking
if there is any other way to achieve this result in Ant that I'm not seeing because I have
the wrong mental model.

Ant itself refrains from providing tools (tasks/types) that would make
it easy to (ab)use it as a programing language. It aims at being very
declarative, and not scripty. The rational is that it's very easy to
abstract or hide away the scripty part in smart tasks, and since Ant
is easy to extend (once the initial learning curve hump is past), in
Java code or using true scripting language, it's the recommended way.

That said, the Ant-Contrib project supplements Ant with <for>, <if>,
<switch>, <try/catch>, etc... Except for <for>, I've used it seldom,
or only initialy to prototype something before migrating the same
logic into custom tasks. --DD

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message