Hello xalan developers,
I am exploring the possibilities to write an XSLT-based WYSIWYG XML Editor. This means, I want to edit the HTML-Output of an XSLT-Transformation and change the originating XML Document. I know that have to rewrite some (or many) parts of Xalan, but I am willing to do so :)
First, the concept:
The base concept is to annotate every generated output with the location and templates in the xslt-file, that were responsible for generating each output fragment. In addition, I annotate the output with every matching XPath-Query that was done, to link back to the original document. I will even add the not-matched querys (like unsatisfied xsl:if statements, to find the output positions, that have to be reevaluated, after a part of the original xml document changes. All matched or unmatched annotated XPathQuerys in the output document will have a context supplied, if they are relative.
Now when i add some text to the result document, i can find out the source location in the xml document, change that, a by scanning the xpath querys in the result document, i can find out which parts of the transformation i have to redo.
If someone is interested, I would like to provide a larger description document to discuss it.
Second, my estimation of my chances:
After three days of digging through the Xalan Sources (I found a few bugs while doing so, I send the patches later), I found out, that I could provide an enhanced SerializationHandler, that has a back reference to the transformer, or just is a trace listener, to have the input ready for annoting my output document, to refer back to the originating xml document.
Third, my questions:
(I will code to achive those goals, but just need to know, if the current architecture of xalan would support it, before start hacking)
Q1: Is it possible to start transforming just for a small range of the originating document, like just applying a template to a given node in the xml tree, and capturing just this small part of output? I need this when I have to rebuild parts of the document.
Q2: How do i do only a partial transformation? I think of selection a node from my originating document, and the transform only this part of the xml document.
Q3: In the sources i found, that the DTM that was build from the XML-Document, is not assumed to change during the transformation. Is it possible to reuse a changed DTM with the same tranformer to redo some part of the transformation, like stated in Q2?
Q4: Can I reuse compliled XPathExpressions, if the underlying DTM changes? (For Speed)
Q5: Dis someone do this before?
Q6: Do you think I am completly mad trying this? :)
Ciao,
Daniel Migowski
