velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Warner Onstine <>
Subject Re: Texen or dvsl
Date Sat, 12 Apr 2003 21:43:24 GMT
Thanks for the demo, now I have progressed a little further and am running
into a Velocity/Jelly issue. Don't know if this is appropriate here or not.

So, in a jelly file I am parsing the xml and then when I hit a particular
element I want to pass in the document for xpath grabbing in the velocity
template. The problem I am running into is trying to cleanly separate what
jelly does and what the velocity template will do.

If I am correct (can't find this in the velocity doc), velocity can't
actually create any new objects (such as an xpath statement). If this is
true it's going to make it a little more difficult to do what I want to do.

The only alternative I can see at this point is to do all my xpath stuff in
jelly and then pass it into the template. Or write some DVSL capabilities
into a class and use that class.



On 4/11/03 9:25 PM, "Pete Kazmier" <> wrote:

> Warner Onstine <> writes:
>> This sounds interesting. Do you have any examples of this? I am
>> checking out jelly and the velocity taglib for it now. But it would
>> be nice to see a concrete example.
> Here is a concrete example which happens to use Maven for execution.
> First, I've defined a Maven goal called 'demo' in my maven.xml file:
> <project 
>   xmlns:j="jelly:core"
>   xmlns:v="jelly:velocity">
>   <goal name="demo">
>     <!-- Stuff the context with something -->
>     <j:set var="name" value="Pete Kazmier"/>
>     <j:set var="age" value="29"/>
>     <!-- Use Velocity to merge the template. -->
>     <velocity:merge
>       name="demo.txt"
>       basedir="."
>       template="demo.tmpl"/>
>   </goal>
> </project>
> The above Jelly instructs Velocity to merge the Jelly context with the
> template called 'demo.tmpl' and store the result of this in the file
> called 'demo.txt'.  The following is my 'demo.tmpl':
> My name is $name, and I am $age years old.
> As you might guess, the contents of 'demo.txt' after the merge looks
> like this:
> My name is Pete Kazmier, and I am 29 years old.
> Thats all you have to do.  Its actually very simple and very powerful
> given the infinite ways to load up the Jelly context.  You can easily
> stuff anything in there which makes this a very powerful mechanism for
> template generation.  In fact, after I wrote the taglib (based on an
> idea by James Taylor), I ripped Texen out of Maven and replaced it in
> its entirety.  If you want a more detailed example, go to the Maven
> sources and check out the 'xdoc' plugin.
> Thanks,
> Pete
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message