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').
--
dIon Gillard, Multitask Consulting
Blog:      http://blogs.codehaus.org/people/dion/





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to