velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Corneil du Plessis" <>
Subject RE: Getting lines of text individually
Date Wed, 06 Mar 2002 20:56:01 GMT
Create a Toolbox class that will use the StringTokenizer to return the
lines. From the XML point of view those lines are part of one text element.

Corneil du Plessis
(h) +27 (11) 918-1592
(w) +27 (82) 802-5768

-----Original Message-----
From: Diane Holt []
Sent: Wednesday, March 06, 2002 9:41 PM
Subject: Re: Getting lines of text individually

>#set($lines= ["Hello","there","Diane"])
>#foreach($line in $lines)
>Will output

Oops -- guess I should have been more clear. What I meant to ask was, is
there any way to have individual lines of input text be dealt with? In
other words, if I have:

Three lines
of text in
an XML file.

and I don't want to have to code a hard linebreak on them, but rather, use
a #foreach to do that for me, is there a way to do that?

Note: I don't know Velocity or Anakia, so I may be asking the question all
wrong, but in looking at the site.vsl file (for the Ant pages), it has a
couple of #foreach loops:

  #foreach ( $items in $section.getChildren() )
  #foreach ( $items in $subsection.getChildren() )

that pass $items to the templates.vm file (if that's the right way to put
it), and $items seems to be the entire block of text between the (defined)
<tag></tag>. I'm wondering if there's some way to have it retrieve the
text and deal with it as individual lines first, have it add a <br></br>
to the end of each one, then pass the whole block off.



Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message