Continuing from my last post, I still haven't figured out how I should update the source document.  

I've worked a bit on the XML-to-XML transformation logic producing a copy of the original XML with one particular node updated in some way (for example, add new attribute or change text content).  The original XML is transformed into HTML where a <span contentEditable='true' id="something"/> is generated for each element in the doc.   I've tried two strategies, one using generate-id() and one generating an xpath expression to uniquely identify the element being modified.  Strategy one sets <span id="{generate-id()}"/>.  Strategy two sets <span path="{my:path(.)}"/> where my:path is a custom function generating "/step-one[1]/step-two[n]/.../step-n[m]".

With strategy one, I'm afraid that document insertions will change the value of generated ids for elements that follow.  Is this true?  I noticed that Saxon-CE, Saxon-HE and Saxon-EE (as run in oXygen) generate different values for the same elements in the same document.  Can I assume the ids will always be the same within the same transformation engine for the same document?

With strategy two, it doesn't appear that saxon:evaluate() is implemented in Saxon-CE.  I could write a recursive template that splits the path on slash '/' and walks down through the document one step at a time.   What a pain.  

I'm afraid that an identity transform of the entire document is a lot of work just to inject a text node within a particular element.  Do I then have to re-render the entire page because ids or paths have changed?  Perhaps I should mark-up the original source document with id's before rendering the HTML so the ids in the document are fixed.  I could do this as an preliminary analysis XML-to-XML transformation and fix the id values in the document.

What to do?  I know I saw a model update in Eric van der Vlist's Amsterdam XML presentation.  He wrote a custom event processor to pass events between the View XSL and the Model XSL.  Perhaps there's an answer to be found there.  This presentation can be found here:    The thing is, the Model XSL in Eric's presentation has hard-coded a match template for the particular node being updated.  I need a generic solution.   I'll give it another go tomorrow.