You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Yves Martin <yv...@elca.ch> on 2006/02/16 11:23:06 UTC

How to escape formal reference notation ?

   Hello,

 I'm trying to generate a Ant build.xml with Velocity and I'm currently
 fighting to output the Ant property access ${myproperty}

 In fact, it is more complex because the property name uses dots.

 To be concerte, I have a $set reference (equals to "foo" for instance), and I
 want to generate 
   ${javadoc.foo.title}
 from $set in place of foo.

 What should I do to get such a result ?
 Thank you in advance for your help
-- 
Yves Martin


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


Re: How to escape formal reference notation ?

Posted by ap...@recks.org.
Use velocity's form of poor man's escaping, which will always work:

#set ($D = '$' )
${D}{javadoc.${set}.title}

will then properly output: ${javadoc.foo.title} as you desired.

If you have the EscapeTool in the context (from VelocityTools)

$esc.d{javadoc.${set}.title}

Cheers,
Christoph

P.S. you will find tip like these if you search (here "escape")
      in the velocity-user mailing list archives.

Yves Martin wrote:
>    Hello,
> 
>  I'm trying to generate a Ant build.xml with Velocity and I'm currently
>  fighting to output the Ant property access ${myproperty}
> 
>  In fact, it is more complex because the property name uses dots.
> 
>  To be concerte, I have a $set reference (equals to "foo" for instance), and I
>  want to generate 
>    ${javadoc.foo.title}
>  from $set in place of foo.
> 
>  What should I do to get such a result ?
>  Thank you in advance for your help

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