>if I pass a document Node, I get an error during the transformation >process, it denies the creation of a new element directly under the >document node.
Document nodes became relatively immutable in DOM Level 2 (though that's relaxed slightly in DOM Level 3) for reasons related to subclassing of the DOM. If you're working with a DOM that does not permit altering the Document node's root element, you can't pass in a Document node and have this work. I believe there is an outstanding wishlist item to change DOMResult so we could pass in a DOMImplementation and possibly a DocumentType (or retrieve those from a sample Document node) , and use the DOMImplementation.createDocument() method to properly create a new DOM tree. But I don't think that's been implemented yet. This shouldn't be hard to code up; if someone wants to sketch a solution and submit it, that'd be great... Workaround: Build into a DocumentFragment, and postprocess to re-instantiate the root element in a new document and use importNode to migrate the element's contents into that new element node. If the new DOM is in the same implementation as the old one, most DOMs are able to migrate the nodes over without having to recreate them, so this is annoying but not expensive. If I remember correctly, DOM Level 3 may (or may not, implementation dependent due to the same subclassing issues) permit creating an empty Document node and then adding to it. We'll still want the build-via-DOMImplementation support added, though. ______________________________________ Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more. "The world changed profoundly and unpredictably the day Tim Berners Lee got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
