I'm using freemarker to do some XSLT-like transformations. I've created a working template, but it's ugly (see the example). But some of the elements aren't being transfomred at all. Is there a way I can use XPath expressions to insert entire elements into the XML? For example,
<Root>
<A>
<B>bb</B>
<c>cc</c>
</A>
<D>
etc
</D>
</Root>
Currently this is my template:
<Root>
<A>
<B>${doc.Root.A.B}</B>
<C>${doc.Root.A.C}</C>
</A>
<D>
etc
I tried using an XPath expression like "${doc["/Root/A"]}" but I got the error "This element with name "A" has a child element named: B". Is there a way to insert an element queried using XPath directly in the xml?