Thanks, everyone. This is the problem: $sentence is a NamedList node, with a 
name and a "value" (any Java object). I want its value subnode:

#foreach($sentence in $outer)
$sentence = $sentence.value



| >> 
| >> Here is the XML from a search result:
| >> <lst name="outer">
| >> <lst name="sentence">
| >>   <int name="index">0</int>
| >>   <str name="text">
| >>   A bunch of words
| >>   </str>
| >> </lst>
| >> more sentences ....
| >> </lst>
| >> 
| >> Here is my Velocity code:
| >> #foreach($sentence in $outer)
| >>   Raw data: $sentence
| >>   <br/>
| >>   #set($index = $sentence.get('index'))
| >>   #set($text = $sentence.get('text'))
| >>   <div class="text">
| >>     Index: $index
| >>     <br/>
| >>     Text: $text
| >>     <br/>
| >>   </div>
| >> #end
| >> 
|
| 
| 

Reply via email to