I just want to document a solution to a problem I was having with transformToFragment.

I was having trouble with XSLTProcessor::transformToFragment() returning null on WebKit browsers (Safari and Chrome). Having read comments about issues with the load() method and xsl:import element, I used XMLHttpRequest and a very simple stylesheet and XML document for testing. Even after having eliminated the well-known problems, I was still disappointed to get a null return value from transformToFragment().

Finally, I noticed that one example used:
<xslutput method="html" />
where I had been using:
<xslutput method="xml" ... />

When I changed my method to "html", the transformToFragment() worked.

I hope this small bit of information will help someone.