Project

Profile

Help

Help Loading Saxon CE

Added by Mark Salamon over 9 years ago

I'm calling Saxon straight from JS, as I need to use XSLT2 in the browser. Without going into too much detail about my project, I have XML that contains data to be displayed in a jquery Flot chart and the data needs to be converted into JSON first. I have successfully used Saxon CE to transform the XML into JSON.

The problem that I have is that all of my code starting with the transformation (or any functions I call) must reside within:


window.onSaxonLoad = function()
{
// all code
}

That works fine when there is only a single chart being created on the page. But sometimes I want to load multiple charts in parallel. I can't seem to find a way to have Saxon called twice on the same page, one time after the other. The loading of Saxon by one script completely blocks it in the other.

I have tried to load Saxon initially on the page using setTimeOut and a callback, waiting for Saxon to load until any process tries to make calls on Saxon, but I have not gotten this to work.

Is there any way to force Saxon to be instantiated at the time the <script> is called (and to wait until that happens), or some other way to achieve what I am looking to do?


Please register to reply