The <do> isn't really required... unless you have an <in> fileset.
BOb -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Guy Metz Sent: Tuesday, December 11, 2007 5:14 PM To: 'Ken Rogoway'; nant-users@lists.sourceforge.net Subject: Re: [NAnt-users] Using a property as a counter Is the syntax you sent exactly what you have in the file. Shouldn't the if task be a child of the Do element? -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ken Rogoway Sent: Tuesday, December 11, 2007 4:27 PM To: nant-users@lists.sourceforge.net Subject: [NAnt-users] Using a property as a counter 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 ------------------------------------------------------------------------ - 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 ------------------------------------------------------------------------- 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