velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Denis <j...@respublica.fr>
Subject Re: 1 xml file to many
Date Fri, 13 Sep 2002 09:24:37 GMT

On Friday, September 13, 2002, at 12:23  am, Charles N. Harvey III 
wrote:

>> There's no DVSL switch.  The problem is that you are escaping the
> entities.
>>
>> If you do something like :
>>
>>
>>  <foo><![CDATA[&lt;p&gt;&amp;nbspSome 
>> Text&amp;nbsp;&lt;/p&gt;]]></foo>
>>
>> That should solve it.  I am assuming much here, but I think this 
>> is what
> you
>> want...
>>
>

You could also escape the & with &amp;:

<foo>&amp;lt;p&amp;gt;&amp;amp;nbspSome 
Text&amp;amp;nbsp;&amp;lt;/p&amp;gt;></foo>


>
>
> One more question...
>
> $variable.toString.substring(0,5)	-	works!
> $variable.toString.replace('a','b')	-	does not.  And I cannot 
> figure out
> why.
>
> I keep getting "is not a valid reference" in the output.  I can do 
> every
> operation
> on a string except replace?  Is there something I don't know.  
> I've been
> killing
> myself over this for two hours now.  :)

Because there are no chars in the template.
Velocity doesn't try to coerce the strings 'a' and 'b' to chars, so 
the call fails.

You could do:

#set ($replace = "ab")
$variable.toString.replace($replace.charAt(0), $replace.charAt(1))

Cheers,

-- Denis.

>
>
> Thanks again.
>
> Charlie


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


Mime
View raw message