ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sagi Mann <sagim...@gmail.com>
Subject AntX: $map example from guide fails when key is missing?
Date Wed, 10 Dec 2008 18:07:25 GMT

Hi all,
I'm trying to adopt example #2 from the $map URI guide:
http://antxtras.sourceforge.net/AntXtras/docs/userguide/valueuris/map.html
http://antxtras.sourceforge.net/AntXtras/docs/userguide/valueuris/map.html 

like so:
For each property in the 'p1' set, I print the value of the same property in
set 'p2'. For testing purposes, I print this TWICE: once by directly
echoing:
${$map:xxx?@(key)} 
and second by assigning the values to variables first, then echo the
variables:

<ax:foreach i="key" list="${$map:p1?keys}" mode="local">
		<echo message="prop ${key}: expected=${$map:p1?@(key)}
existing=${$map:p2?@(key)}"/>
		<ax:assign name="expected" value="${$map:p1?@(key)}"/>
		<ax:assign name="existing" value="${$map:p2?@(key)}"/>
		<echo message="prop ${key} values: expected=${$var:expected}
existing=${$var:existing}"/>
</ax:foreach>

If p1 and p2 contain the same property keys, all is ok. If p1 contains a
property that does NOT exist in p2, the first echo is ok and displays (as it
should):
prop myprop: expected=1 existing=${$map:p2?@(key)}
But the second assign fails with the error:
Syntax error in property: ${key

I need to be able to assign the result to variables (or use it in a domatch
value attribute, which generates the same error). Does someone has any idea
why this does not work properly?

thanks.
-- 
View this message in context: http://www.nabble.com/AntX%3A-%24map-example-from-guide-fails-when-key-is-missing--tp20940737p20940737.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message