Don't ever do that. A fundamental principle of XSLT is that the source tree is immutable. By changing the tree during a transformation you risk confusing the processor. There is no attempt during processing to detect changes to the tree -- in fact, the assumption everywhere is that the tree _cannot_ change.
That's unfortunate, but I guess it makes sense, for the shear sake of efficiency.
At any rate, I've no idea how, within a transformation, you'd even get access to the the original input DOM, since it's wrapped in the DTM. If, somehow, something external to the processor might change the tree, you need to prevent that from happening.
I guess I was thinking more along the lines of "modifications during a DTM wrap". For example, what happens if I extend xerces and supply my own getNodeValue() function, which makes a call to Xerces' setNodeValue()? It appears that DOM2DTM calls Xerces' NodeImpl class members to do the conversion (as it well should!).
Let me describe the situation:
1) I override getNextSibling() to return 'this' a certain number of times. Each time it is called, it increments an internal counter +1
2) I override getNodeValue() to access an array of primitive types at the index specified by the above mentioned counter, and call setNodeValue() to change the node's value to current index.
I have tried simply returning the value from getNodeValue() as a string, but Xerces appears to be caching the node's value because getNodeValue() is never called. (Xalan's DOM2DTM does call it, however.)
I haven't actually tried calling setNodeValue() from within my custom getNodeValue() yet, so I don't know how it behaves.
In theory it should work, but I have been discovering all sorts of little complexities here and there, and haven't come up with a fully-functional application yet. It looks like what this is coming down to is extending the DTM (see my last e-mail).
What happens if you modify a Xerces DOM from within a Xalan transformation (in the same thread, while Xalan is running the transform)? Is it synchronized such that it will produce a deadlock, will the new changes be available to Xalan, or will the changes be delayed until the transformation finishes?
Toby
Toby -- Tobias McNulty Data Description, Inc. 840 Hanshaw Road, Suite 9 Ithaca, NY 14850 Phone: (607) 257-1000 E-mail: [EMAIL PROTECTED] Web: www.datadesk.com
