Re: Create a new node tree
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Tuesday, July 22, 2008, 11:26:19 PM, Denis Bredelet wrote: > Hello > > I would like to use FreeMarker for some XML transformation job. Is > there a built-in way to create new nodes, so that I can make changes to the tree? > Is it better to output the new tree as text in the template? > > <NewNode> > [#recurse children[0]] > <NewNode2> > [#recurse children[1]] > </NewNode2> > </NewNode> > > versus > > [#assign NewNode = .node?new_child] (imaginary built-in) > [#assign NewNode[children[0]?node_name] = children[0]] > etc. FreeMarker doesn't transform XML in the sense as XSLT does, namely, it doesn't transform a tree of nodes to another tree of nodes, but a tree of nodes (plus possibly other data) to text (stream of char-s), which for example can be XML of course. So you just output the new tree as text. > Thank you. > -- Denis. -- Best regards, Daniel Dekany ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/