I want to count the number of times a particular <if> test is true. I have the following Nant script snippet: <property name="WarningCounter" value="0" />
<foreach item="Line" in="myfile.txt" property="oneLine"> <if test="${string::starts-with(oneLine,'WARNING')}"> <property name="WarningCounter" value="${int::parse(WarningCounter)+1}" /> </if> </foreach> <echo>There were ${WarningCounter} warnings.</echo> I always get 1 for the warning counter, even if there is more than one line in the file with WARNING. I have also tried changing the int::parse()+1 to convert::to-int()+1. What is the proper way to do this? Thanks, - Ken Rogoway No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.17.1/1181 - Release Date: 12/11/2007 5:05 PM ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ NAnt-users mailing list NAnt-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users