On Jan 5, 2009, at 7:39 PM, Mike McDonough wrote:

What I'm looking for would be a way to translate the Velocity template
before execution/rendering so that any conditional logic would be intact,
but in XSL/XSLT instead of Velocity.

Well, you could probably do it with regex in your favorite language, but what is the point? You data is going to change from java objects to some XML structure (and possibly parameters passed to the transformation). How would these map? If there is a way to cleanly map them, then I would ask what are you gaining by doing this with XSL/ XML? -- velocity would most likely perform better and require less system resources.

Also, if you have 50+ velocity templates, you don't want to have 50+ separate, unique XSL javax.xml.transform.Templates. You probably want to take the velocity templates and convert what you can to a 50+ XML instances and use that as a source in an XSL that handles ALL of your templating needs.



It may not be possible to build a parser that does this, which was my first
reaction, but sometimes management insists...

unless you are not divulging something important, it seems like a pointy-headed task to begin with. At least to me, XSL and velocity have totally different strengths. I would (and do) use XSL to *pre* generate the velocity templates. This way you have all the control you need over layout/styling. The velocity templates would be used at runtime. This usage also allows you to switch out your runtime scripting/templating language rather easily.

-Rob



Thank you for the input so far. Any other ideas?


On Mon, Jan 5, 2009 at 3:16 PM, Nathan Bubna <[email protected]> wrote:

Like Robert, i'm a bit skeptical, but if you want to try and automate
things, look into the RuntimeInstance class.  You can use the
parse(...) method to load and parse a template and get a SimpleNode
for the root of the AST. You can then walk the tree however you like,
i think.

On Mon, Jan 5, 2009 at 12:47 PM, Mike McDonough
<[email protected]> wrote:
Hi, I'm scoping out a project that requires converting a numbe of
Velocity
HTML templates (50+) into XSL/XSLT/XML based templates. By conversion, I
mean the templates themselves, not the rendered output. The XSL type
templates would then be used going forward instead of Velocity.

Are there any tools available or techniques that could be used to
automate
this task? As I've never personally used Velocity, this may be out of
left
field, but thought I would check to see what's available before I go down
the road of doing it completely by hand.

Thanks for your help!


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to