[jdom-interest] Transforming multiple sources into out result

Brian Sayatovic/AMIG BSayatovic at amig.com
Thu Nov 20 07:14:11 PST 2003




I'm using JDOM b9 and Xalan to do some pretty convoluted trasforms.  At one
point, I need to transform two Documents into one.

My previous solution, which was kind of ugly, was to clone the root element
of each document and add it to a new, combined Document, then apply the
transform to that document.

However, when I switched to b9, I thought I found a better solution (which
I ca't get to work).  What I'd like to do is transform using the
JDOMSource(List) form of the source constructor.  As I read it, it should
for any list of JDOM nodes (which I think includes, Document, Element,
Comment, etc.).  However, after I transform, the resulting Document errors
because "Root element not set".

I've seen some solutions that use the "document()" xsl function, but I
don't want to use that because my documents don't exist on disk -- they
exist transiently in memory (the documentation days that the "document()"
function requires URIs to the XML documents which implies physical
locations).

Any ideas?

Regards,
Brian.





More information about the jdom-interest mailing list