Re: [FreeMarker-user] freemarker xml/xslt functions
Generates text that depends on changing data (like dynamic HTML).
Brought to you by:
revusky
|
From: Jonathan R. <re...@gm...> - 2005-12-21 21:27:46
|
On 12/21/05, Russell Simpkins <rus...@ho...> wrote:
> Hello all.
>
> I am sick of xslt. I have managed to use digester to convert my XML to PO=
JO
> to use Velocity on the frontend. I could just use freemarker the same way=
. I
> just started looking at freemarker, and I love the XML support. Sooooo mu=
ch
> better than anakia. It looks like I could skip the digester -> pojo part
> too.
>
> I have made great use of the document function in my xslt and am having
> trouble doing document() in FreeMarker.
Hi Russell,
I'm glad you're finding the XML functionality useful.
Once you get used to FreeMarker, there is really no problem in putting
a tool ('tool' being Velocity-speak really) in your context that can
load XML data from some external location. You could implement the
freemarker.template.TemplateMethodModel API and have one or more
strings that indicate where to load the template from. You would want
your TemplateMethodModel's exec() method to return an instance of
freemarker.ext.dom.NodeModel.
Another way is just to expose a POJO that does it and returns an
instance of org.w3c.dom.Element or whatever (actually we support JDOM
and DOM4J as well) and that will get wrapped transparently into a
NodeModel object that can be used from the template side.
Hope that helps,
JR
|