transformToHTMLFragment

transformToHTMLFragment($source as Node?, $ownerDocument as Document?) → DocumentFragment

Returns the result of an XSLT transform as one or more HTML DocumentFragment objects.

Arguments

 

$source

Node?

The source document or node to be transformed

 

$ownerDocument

Document?

The owner document for the HTML fragment

Result

DocumentFragment

Details

If no source document is supplied then an initialTemplate must be set. All DocumentFragments must have an owner document, if none is supplied as a parameter the owner is set to the host HTML document.

This function returns a collection of HTML fragments that can be appended directly to the DOM. Each returned fragment can contain a number of nodes, but can be appended to an HTML DOM element as a single node. The getResultDocument and getResultDocuments functions are used to retrieve each result fragment. Note that the updateHTMLDocument function provides similar functionality, but fragment updates are peformed entirely within the XSLT using the xsl:result-document instruction's href attribute to specify the target node for each result fragment.