{ Frameless }


The transformToFragment($source, $ownerDocument) function specifies that the transformation should result in a DocumentFragment.

When the templates are meant to create new elements for the current HTML page, this method is for you:

frag = xslt.transformToFragment(window.document)

window.document says the template output is meant to be used in the current document.

Element must be created specifically for one document, that's why it's necessary to specify the document up front. Using this methods cousin transformToDocument() generates the output in it's very own document, which also means they're not usable in your HTML page.

var xslt = new XSLT2Processor;
var doc = sync_GET("test.xml");
var output = xslt.transform(doc);

Or using the jQuery plugin: