Use <for> task from ANT contrib:

<for param="file" list="${ports}" delimiter="${line.separator}">
<sequential>
        <echo message="Current file is '@{file}'" level="info" />
</sequential>
</for>

SHOULD work (not tested, maybe you have to change the delimiter to a comma
for the construction of the ports-property)

Klaus

> -----Original Message-----
> From: Ding Shukai [mailto:[EMAIL PROTECTED] 
> Sent: 12 December, 2005 10:14
> To: Ant Users List
> Subject: Re: How to get each file's name in a fileset?
> 
> great. It works well .
> but I still have a question: how to use the property ${ports} 
> ? The buildfile  gets a property containing ports separated 
> by line.separator, but I still do not know how to retrieve 
> each port name from the ${ports}.
> bow~
> 
> 2005/12/12, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> >
> > try nested mappers
> >
> > 01: <project>
> > 02:     <property name="schema.dir" location="schema"/>
> > 03:     <pathconvert property="ports" pathsep="${line.separator}">
> > 04:         <fileset dir="${schema.dir}" includes="**/*.wsdl"/>
> > 05:         <map from="${schema.dir}${file.separator}" to=""/>
> > 06:         <mapper>
> > 07:             <chainedmapper>
> > 08:                 <globmapper from="*.wsdl" to="*"/>
> > 09:                 <flattenmapper/>
> > 10:             </chainedmapper>
> > 11:         </mapper>
> > 12:     </pathconvert>
> > 13:     <echo>PORTS:</echo>
> > 14:     <echo>${ports}</echo>
> > 15: </project>
> >
> >
> > 02: Define the schema dir as location, so I can reuse the absolute 
> > path in the <map> element.
> > 03: Use ${line.separator} for better output. Use like you want.
> > 05: Deletes the leading absolute path. Because 02 gets only 
> the path 
> > we also have to delete the
> >    dir separator there.
> > 07: Apply two mappers in chain. Otherwise you´ll double 
> your output....
> > 08: Delete the suffix
> > 09: Delete directory hierarchy.
> >
> >
> > C:\TEMP\ant-mapper>tree /A /F
> > C:.
> > |   build.xml
> > |
> > \---schema
> >    |   123.wsdl
> >    |   4711.wsdl
> >    |   XXX.wsdl
> >    |
> >    \---dev
> >            9998.wsdl
> >            9999.wsdl
> >
> >
> > C:\TEMP\ant-mapper>ant
> > Buildfile: build.xml
> >     [echo] PORTS:
> >     [echo] 123
> >     [echo] 4711
> >     [echo] XXX
> >     [echo] 9998
> >     [echo] 9999
> >
> > BUILD SUCCESSFUL
> > Total time: 0 seconds
> > C:\TEMP\ant-mapper>
> >
> >
> > Jan
> >
> >
> >
> > >-----Ursprüngliche Nachricht-----
> > >Von: Ding Shukai [mailto:[EMAIL PROTECTED]
> > >Gesendet: Montag, 12. Dezember 2005 05:54
> > >An: user@ant.apache.org
> > >Betreff: How to get each file's name in a fileset?
> > >
> > >hi,
> > >In my project, the ant buidfile needs to know each file's 
> name in a 
> > >fileset.
> > >For example, there exists some files like XXX.wsdl in the 
> schema dir; 
> > >if I could get the string XXX, which is a porttype name, then I 
> > >neednot to specify the porttype names in build.properties. Could 
> > >anyone Help me, please? Thanks~
> > >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED] For 
> additional 
> > commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to