| <!DOCTYPE html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body > |
| <script> |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| var xsltp = new XSLTProcessor(); |
| var doc; |
| |
| function test(method) { |
| try { |
| var xml = '<?xml version="1.0" encoding="UTF-8"?>'; |
| var style = '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> \ |
| <xsl:output indent="yes" method="'+method+'"/> \ |
| </xsl:stylesheet>'; |
| |
| var xmlDoc = new DOMParser().parseFromString(xml, "text/xml"); |
| var xslDoc = new DOMParser().parseFromString(style, "text/xml"); |
| |
| xsltp.importStylesheet(xslDoc); |
| doc = xsltp.transformToDocument(xmlDoc); |
| |
| xsltp.reset(); |
| } catch(e) { |
| document.write("Exception: " + e); |
| } |
| } |
| |
| function runTests() { |
| test('html'); |
| shouldBe('doc.contentType','"text/html"'); |
| |
| test('xml'); |
| shouldBe('doc.contentType','"application/xml"'); |
| |
| test('text'); |
| shouldBe('doc.contentType','"application/xhtml+xml"'); |
| |
| test('foo'); |
| shouldBe('doc.contentType','"application/xml"'); |
| |
| test('xhtml/foo'); |
| shouldBe('doc.contentType','"application/xml"'); |
| } |
| |
| runTests(); |
| </script> |
| </body> |
| <script src="../../resources/js-test-post.js"></script> |
| </html> |