Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / xsl / default-html.html
blobba5f7184db2ebb5d95f2461012c1c1f452d272e1
1 <html>
2 <body>
3 <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=11694">bug 11694</a>:
4 XSLT output method does not default to HTML when the target document is HTML.</p>
5 <div id="result">Should be green: </div>
6 <div id="result2">Should be black: </div>
8 <script>
9 if (window.testRunner)
10 testRunner.dumpAsText();
12 var xsl = (new DOMParser()).parseFromString('<?xml version="1.0" encoding="ISO-8859-1"?>'+
13 '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">'+
14 '<xsl:template match="doc">'+
15 '<span style="color:green">result.</span>'+
16 '</xsl:template>'+
17 '</xsl:stylesheet>', 'application/xml');
19 var xsl2 = (new DOMParser()).parseFromString('<?xml version="1.0" encoding="ISO-8859-1"?>'+
20 '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">'+
21 '<xsl:output method="xml"/>'+
22 '<xsl:template match="doc">'+
23 '<span style="color:green">result.</span>'+
24 '</xsl:template>'+
25 '</xsl:stylesheet>', 'application/xml');
27 var xml = (new DOMParser()).parseFromString('<?xml version="1.0" encoding="ISO-8859-1"?>'+
28 '<doc/>', 'application/xml');
30 var processor = new XSLTProcessor();
31 processor.importStylesheet(xsl);
32 var result = processor.transformToFragment(xml, document);
34 document.getElementById("result").appendChild(result);
36 // The HTML default shouldn't override an explicitly specified method.
37 var processor = new XSLTProcessor();
38 processor.importStylesheet(xsl2);
39 result2 = processor.transformToFragment(xml, document);
41 document.getElementById("result2").appendChild(result2);
43 if (document.getElementById("result").childNodes[1].style.color == "green" &&
44 !document.getElementById("result2").childNodes[1].style)
45 document.write("<p>SUCCESS</p>");
46 </script>
47 </body>
48 </html>