You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David Weller <dg...@yahoo.com> on 2000/08/06 02:24:43 UTC

Nested property expansion...

Apologies in advance is this has been asked before, but...

Why is it not possible to recursively expand names within the XML buildfiles?
Example (slightly bogus, but I hope it conveys my point):
<property name="file" value="file.java"/>
<property name="fq_file" value="${basename}/${file}"/>
<property name="${fq_file}" value="Hello there"/>
<echo message="The property ${fq_file} contains ${${fq_file}}"/>

When I run this in verbose mode, the property is correctly set, but I can't
print the value out through the echo task.  My guess is (originally) that it
had to do with the XML parsing, but this really seems like a problem with the
echo task.  Am I right?

P.S. -- If this has an 'obvious' solution, be gentle with me, my Ant knowledge
is 4 hours old :-)


__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/

Re: Nested property expansion...

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "DW" == David Weller <dg...@yahoo.com> writes:

 DW> Why is it not possible to recursively expand names within the XML
 DW> buildfiles?

because you can't 8^).

When Ant encounters a ${xyz} construct it looks up a property of the
name xyz. It doesn't even try to see whether xyz holds ${} which could
be translated again. 

And I really don't think I'd like to add it, there should always be a
cleaner way to achieve the same result - a way that'd be far more
readable. What would you really want to do with it? Do you have a real
example?

Stefan