ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# B.21 ForeachTask The `foreach` task iterates over a list, a list of `filesets`, or both. If both, `list` and `filesets`, are specified, the list will be evaluated first. Nested `filesets` are evaluated in the order they appear in the task. Table B.22:聽Attributes NameTypeDescriptionDefaultRequired`inheritall``Boolean`If `true`, pass all properties to the called target.falseNo`inheritrefs``Boolean`If `true`, pass all references to the the called target.falseNo`trim``Boolean`If `true`, any leading or trailing whitespace will be removed from the list item before it is passed to the requested target.falseNo`list``String`The list of values to process, with the delimiter character, indicated by the "delimiter" attribute, separating each value.n/aNo`target``String`The target to call for each token, passing the token as the parameter with the name indicated by the "param" attribute.n/aYes`param``String`The name of the parameter to pass the tokens in as to the target.n/aYes`absparam``String`The name of the absolute pathparameter to pass the tokens in as to the target (used while processing nested filesets).n/aNo`delimiter``String`The delimiter string that separates the values in the "list" parameter. The default is ",".,No B.21.1 Examples ``` <!-- loop through languages, and call buildlang task with setted param --> <property name="languages" value="en,fr,de" /> <foreach list="${languages}" param="lang" target="buildlang" /> <!-- loop through files, and call subtask task with set param and absparam --> <foreach param="filename" absparam="absfilename" target="subtask"> <fileset dir="."> <include name="*.php"/> </fileset> </foreach> ``` B.21.2 Supported Nested Tags - `path` - `dirset` - `fileset` - `filelist` - `mapper`