[jdom-interest] JDOMResult Reuse

Elliotte Rusty Harold elharo at metalab.unc.edu
Thu Oct 24 06:08:38 PDT 2002

The recent changes to JDOMRsult to support List output are important in 
bringing JDOM into compliance with XSLT. We can now handle a lot fo 
stylesheets that couldn't be handled before. Thanks Laurent!

However, as is often the case, fixing one issue reveals another. Looking 
at the code it's not clear to me what happens (or what should happen) if 
the same JDOMResult object is used for the output of multiple 
transformations in series. I don't see anywhere that the result gets 
reset to begin anew with a new list. I think the new nodes would just 
get appeneded to the list of old nodes, which is probably not what we want.

Assuming I'm not missing something, I think maybe JDOMResult needs 
either a reset method, or some documentation about not reusing the 
object for multiple transformations, or both. Ideally I'd like to handle 
this automatically (i.e. as soon as a tranformation starts, reset the 
list of nodes it's building to an empty list) but I'm not sure I can 
find a good place to hook that in. I considered resetting the list in 
startDocument() in the handler, but that doesn't really work because 
startDocument() may not be called if we don't have a complete 


More information about the jdom-interest mailing list