chromium/third_party/blink/web_tests/fast/xsl/default-html.html

<html>
<body>
<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=11694">bug 11694</a>:
XSLT output method does not default to HTML when the target document is HTML.</p>
<div id="result">Should be green: </div>
<div id="result2">Should be black: </div>

<script>
if (window.testRunner)
    testRunner.dumpAsText();

var xsl = (new DOMParser()).parseFromString('<?xml version="1.0" encoding="ISO-8859-1"?>'+
'<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">'+
'<xsl:template match="doc">'+
'<span style="color:green">result.</span>'+
'</xsl:template>'+
'</xsl:stylesheet>', 'application/xml');

var xsl2 = (new DOMParser()).parseFromString('<?xml version="1.0" encoding="ISO-8859-1"?>'+
'<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">'+
'<xsl:output method="xml"/>'+
'<xsl:template match="doc">'+
'<span style="color:green">result.</span>'+
'</xsl:template>'+
'</xsl:stylesheet>', 'application/xml');

var xml = (new DOMParser()).parseFromString('<?xml version="1.0" encoding="ISO-8859-1"?>'+
'<doc/>', 'application/xml');

var processor = new XSLTProcessor();
processor.importStylesheet(xsl);
var result = processor.transformToFragment(xml, document);

document.getElementById("result").appendChild(result);

// The HTML default shouldn't override an explicitly specified method.
var processor = new XSLTProcessor();
processor.importStylesheet(xsl2);
result2 = processor.transformToFragment(xml, document);

document.getElementById("result2").appendChild(result2);

if (document.getElementById("result").childNodes[1].style.color == "green" && 
      !document.getElementById("result2").childNodes[1].style)
    document.write("<p>SUCCESS</p>");
</script>
</body>
</html>