[jdom-interest] Transforming multiple sources into out result

Laurent Bihanic laurent.bihanic at atosorigin.com
Fri Nov 21 00:35:56 PST 2003


Brian Sayatovic/AMIG wrote:
> 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".

This is a problem within your XSL stylesheet. It does not output a well-formed 
XML document. In this case, you should use JDOMResult.getResult to retrieve 
the output as a list of nodes.
Or, if you expect the output to be a document, try outputing the result to a 
file using a StreamResult to see what's wrong.

> 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).

The JAXP TrAX API allows you to register your own URIResolver implementation 
on Transformers. You should then be able to resolve document URIs into 
JDOMSource objects.


More information about the jdom-interest mailing list