[EMAIL PROTECTED] wrote on Thursday, November 27, 2003 7:58 AM:
> J�rg Schaible <[EMAIL PROTECTED]> wrote on 26/11/2003
> 11:49:11 PM:
>
>> Hello,
>>
>> currently I fight with the Jelly script for a plugin extension and I
>> got
>
>> stuck. See the following example:
>>
>> Having following properties:
>> all=y,x
>> prop.x=1
>> prop.y=2
>> prop.z=0
>>
>> I would like to iterate over the properties "prop.<key>" defined in
>> "all":
>>
>> <?xml version="1.0"?>
>> <project xmlns:j="jelly:core" xmlns:u="jelly:util"
>> xmlns:ant:"jelly:ant"> <u:tokenize var="all.split"
>> delim=",">${all}</u:tokenize> <j:forEach var="i"
>> items="${all.split}"> <ant:echo>prop.${i}:${prop[i]}</ant:echo>
>> </j:forEach>
>>
>> The script should have printed:
>>
>> prop.x:1
>> prop.y:2
>>
>> Unfortunately Jelly seems not to support the [] syntax and the
>> second expression evaluates to null. This approach is a syntax error:
>>
>> <ant:echo>prop.${i}:${prop.${i}}</ant:echo>
>>
>> This one will print also nothing useful:
>>
>> <ant:echo>prop.${i}:${<j:expr value="prop.${i}"/>}</ant:echo>
>>
>> So is there any solution to create such assembled variables?
>
>
> Use something like this:
>
> <j:set var="variable">jdbc.database.${jdbc.os}</j:set>
> <j:set var="dbdatabase" value=
> "${context.findVariable(variable)}" />
>
> This sets dbdatabase to the value of the variable ('jdbc.database.' +
> whatever was in the variable 'jdbc.os').
Does not work unfortunately. In your example I get an empty string as content of
"dbdatabase". Looking into Jelly examples I can use the expression
${context.findVariable("variable")}, but this is equivalent to ${variable} and
delivers just the name of the created variable, but not its value ...
I also tried something like
<j:set "temp">$${all.${i}}</j:set>
<ant:echo><j:expr><j:expr value="${temp}"/></j:expr></ant:echo>
but this wont work either, since unlike the set tag the expr tag evaluates only the
value attribute.
:(
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]