This is as close as I've gotten so far:

var saxon2 = Saxon.newXSLT20Processor();                               
saxon2.importStylesheet (excise_xml);                                  
result = saxon2.transformToFragment(document);                         
document.documentElement.replaceChild(result,document.documentElement);                                                                              

but it results in the following error in Chrome:

NotFoundError: An attempt was made to reference a Node in a context where it does not exist.

and a similar NotFoundError: Node was not found in Firefox

not sure where I am going wrong, but if you have an example from your test cases that you can share, I would certainly appreciate it.  I looked in the github repo a little bit, but the tests directory is empty, and I am not prepared too dive deeply into the source at this point.

-Mike

On 02/19/2014 09:16 AM, Michael Kay wrote:
On 19 Feb 2014, at 13:07, Michael Sokolov <msokolov@safaribooksonline.com> wrote:

I've been trying to use Saxon CE to enable convenient interactive 
testing of some stylesheets that will later be used on our server; I 
like this idea since it can be set up outside of the usual server 
infrastructure.  Because of this, I'd like to avoid using any special 
Saxon-CE-specific API calls in the stylesheet: in particular I don't 
really want to make use of xsl:result-document to replace nodes in the DOM.

So my question is whether it is possible to take the main output of the 
transform and install it in the browser in place of the current page's 
DOM using javascript API calls?  I didn't see how.
I would certainly have thought so: it's essentially what we do when emulating the basic xsl:stylesheet processing instruction
mode of operation. But my Javascript is rusty so I'll have to investigate to get a more detailed answer.

      
Michael Kay
Saxonica


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help