Warner Onstine wrote:
> 
> Hi all,
> I'm just hoping there's a better solution to this. I am trying to do this:
> 
> #set ($catLink = "<a href='$linkStr'>$category.Name</a>")
> 
> But, I don't want the href to contain single quotes, but instead double
> quotes. I've looked through the docs and haven't found anything related to
> this.
> 
> Everything that I've tried so far has either resulted in a bad link or an
> error, any help would be appreciated.
> 
> -warner

I assume you would want to do something like :

#set( $catLink = "<a href=\"$linkStr\">$category.Name</a>" )

?

I am asking because I have been playing with this for a while, but can't
make up my mind if I like it, and therefore haven't proposed it...

It solves this problem well, but its another nudge in the direction of
'programming', I think...  (Like I said, I can't make up my mind about
this...)

There are other solutions, such as Jon's #macro() approach, or Patrick's
String.concat()-o-rama.

You could also

#set($dq = '"')
#set($catlink = "<a href=$dq$linkStr$dq>$category.Name</a>")
 
and I think for speed, the VM would be fastest over the long term.

-- 
Geir Magnusson Jr.                           [EMAIL PROTECTED]
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
Be well, do good work, and keep in touch.

Reply via email to