This works for me: <project xmlns:ac="antlib:net.sf.antcontrib">
<macrodef name="values2list"> <attribute name="property"/> <attribute name="prefix"/> <attribute name="size"/> <attribute name="separator" default=","/> <sequential> <ac:var name="@{property}" value="$...@{prefix}1}"/> <ac:for param="nr" begin="2" end="@{size}"> <sequential> <ac:var name="@{property}" value="$...@{property}}@{separator...@{prefix}@{nr}}"/> </sequential> </ac:for> </sequential> </macrodef> <property name="name.1" value="foo"/> <property name="name.2" value="foo"/> <property name="name.3" value="abc"/> <property name="name.4" value="xyz"/> <values2list property="list" prefix="name." size="4"/> <echo>List: ${list}</echo> </project> Jan >-----Ursprüngliche Nachricht----- >Von: Jan [mailto:raghure...@gmail.com] >Gesendet: Mittwoch, 19. Mai 2010 06:41 >An: Ant Users List >Betreff: Multiple properties into one property key > >Hi All, > >I'm trying to read muliple properties into one property key is >that possible >int ant? > >For examble lets say i property file called name.properties in >that i've >entries as shown below >name1=Joe >name2=Jan >numberofnames=2 > >now i want read these 2 property key value and assign to property >allNames=${name1},${name2}.....${namen}, coz i will know the value of >"numberofnames" only at runtime i used ant-contrib 1.0b3 like below > > <for param="num" end="${numberofnames}"> > <sequential> > <if> > <equals arg1="@{num}" arg2="0"/> > <then> > <echo message="XXXXX Skipping the as ant contrib start >with value "0" >and there won't be any property like "name0" will be available" >level="verbose"/> > </then> > <else> > <propertycopy name="name" from="n...@{num}" >override="true"/> > <echo file="props.ext">${name}${line.separator}</echo> > <loadfile srcfile="props.ext" property="${nameList}"> > <filterchain> > <filterreader >classname="org.apache.tools.ant.filters.TailFilter"> > <param name="lines" value="${numberofnames}"/> > </filterreader> > </filterchain> > </loadfile> > </else> > </if> > </sequential> > </for> > >This does stores all name1 and name2 value into props.ext >file, but when i >tried ito read the file usine "loadfile" its just prints the >name1 only not >name2 > >Anyidea? > >Thanks in advance for your help > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org