Remove the test from the do sub-element of the foreach task, and add it
to the echo task. Alternatively, if you want to perform more than just
one sub-task in the do element, place them inside an inner if task.
Chris
Like this:
<foreach item="Line" in="output.log" property="currentLine">
<do>
<echo message="${currentLine}"
if="${string::contains(currentLine,'failed')}"/>
</do>
</foreach>
Or this:
<foreach item="Line" in="output.log" property="currentLine">
<do>
<if test="${string::contains(currentLine,'failed')}">
<echo message="${currentLine}"/>
</if>
</do>
</foreach>
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Michael
Jervis
Sent: 28 November 2006 16:42
To: [email protected]
Subject: [NAnt-users] foreach task: Looping over file lines,property
does not extend
I want to loop for each line in a file that has been produced by a
process and echo all lines with 'failed' in them to the email I'm
sending to the developer list:
<foreach item="Line" in="output.log" property="currentLine">
<do if="${string::contains(currentLine,'failed')}">
<echo message="${currentLine}" />
</do>
</foreach>
However, on the if clause of the foreach, I get the error that the
currentLine property is not set.
Suggestions?
--
Michael Jervis
[EMAIL PROTECTED]
504B03041400000008008F846431E3543A820800000006000000060000007765
62676F642B4F4D4ACF4F0100504B010214001400000008008F846431E3543A82
0800000006000000060000000000000000002000000000000000776562676F64
504B05060000000001000100340000002C0000000000
------------------------------------------------------------------------
-
Take Surveys. Earn Cash. Influence the Future of IT Join
SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
V
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users