Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 81185 invoked from network); 15 Dec 2008 15:38:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Dec 2008 15:38:26 -0000 Received: (qmail 85300 invoked by uid 500); 15 Dec 2008 15:38:35 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 85258 invoked by uid 500); 15 Dec 2008 15:38:35 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 85247 invoked by uid 99); 15 Dec 2008 15:38:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Dec 2008 07:38:35 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [205.158.62.78] (HELO smtp1.us4.outblaze.com) (205.158.62.78) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 15 Dec 2008 15:38:20 +0000 Received: (qmail 21088 invoked from network); 15 Dec 2008 15:37:57 -0000 Received: from unknown (HELO ?127.0.0.1?) (wascallywabbit:earthling.net?mail.com@24.238.83.226) by smtp1.us4.outblaze.com with SMTP; 15 Dec 2008 15:37:57 -0000 Message-ID: <494679C5.4010506@earthling.net> Date: Mon, 15 Dec 2008 10:37:41 -0500 From: Wascally Wabbit Reply-To: Ant Users List User-Agent: Thunderbird 2.0.0.18 (Windows/20081105) MIME-Version: 1.0 To: Ant Users List Subject: Re: AntX: $map example from guide fails when key is missing? References: <20940737.post@talk.nabble.com> In-Reply-To: <20940737.post@talk.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Sagi, A couple of things: 1) Try using ${$prop:p1->@(key)} inside the loop instead of $map: Less overhead and a bit clearer. 2) In AntXtras 0.5.x you cannot assign an empty string to a var (this is fixed in AntXtras 2.0.0 but that's still in alpha) So if the key does not exist in p2, you need a dummy marker string like 'MISSING' or something. I don't completely understand what you're trying to do...but here is some reworked example script for AntX 0.5.1: ${key}: p1='${$prop:p1->@(key)}'; p2='${$prop:p2->@(key)?}'" [Do you processing here...] HTH, The Wabbit Sagi Mann wrote: > 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: > > > > > > > > > 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. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org