On 3 Jan 2014, at 01:12, Todd Gochenour <todd.gochenour@gmail.com> wrote:

It appears that with Saxon-CE, the source document is immutable.  There is no Javascript API on a document which can query or modify a requested XML document.  I need to update the source document based upon user action.  

I think that the source document will normally be Saxon DocumentInfo object wrapping an instance of com.google.gwt.dom.client.Document; the underlying DOM Document is in fact mutable, though Saxon does nothing to encourage treating it as mutable because the XSLT processing model assumes that. 

I'm considering an XML-to-XML transformation to perform this update and I need a way to update the processor with reference to this new transformed source.  There isn't a setSource() function.  So I'm considering passing the source document as a parameter and then I can use setParameter() to update the document reference.  Documentation for XSL20Processor.setParameter() claims to accept nodes as parameter types.

I'm afraid I'm having a bit of difficulty working out exactly what you're trying to do here. Can't quite see why you're using updateHTMLDocument() when you want an Xml-to-Xml transformation? Why not transformToDocument()?

I have this code on load:

onSaxonLoad = function() {
    xsl = Saxon.requestXML("first.xsl");
    xml = Saxon.requestXML("first.xml");
    proc = Saxon.newXSLT20Processor(xsl);

and this XSL:

   exclude-result-prefixes="xs prop"

<xsl:param name="source"/>

<xsl:template match="/">
   <xsl:message>SOURCE:<xsl:value-of select="name($source/*)"/></xsl:message>
   <xsl:result-document href="#main" method="ixsl:replace-content">
      <xsl:apply-templates select="*"/>

I get the error with the <xsl:message/> line which reads: SEVERE: Exception java.lang.ClassCastException in invokeTransform: null 

Could you provide a complete repro for this, please?

Michael Kay