[jdom-interest] Transforming multiple sources into out result

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

Well, I was wrong.  It does work.  I tturns out, I wasn't using the right
Document instance for one of the sources, so naturally, the output wasn't
what I expected (it didn't match ANY templates).

If nothign else, I've confirmed that this does work, so the next time a
poor soul is looking for information about this, maybe they'll find this in
the mailing list archives.


Thursday, November 20, 2003 10:15 AM
To: jdom-interest at jdom.org
From: Brian Sayatovic/AMIG <BSayatovic at amig.com>
Subject: [jdom-interest] Transforming multiple sources into out result

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

Any ideas?


To control your jdom-interest membership:

More information about the jdom-interest mailing list