test_bug551412.html (1498B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=551412 5 --> 6 <head> 7 <title>Test for Bug 551412</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 10 </head> 11 <body> 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=551412">Mozilla Bug 551412</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"></div> 15 <pre id="test"> 16 <script type="application/javascript"> 17 18 /** Test for Bug 551412 */ 19 20 var processor = new XSLTProcessor(); 21 var style = 22 '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ' + 23 'xmlns:exsl="http://exslt.org/common" ' + 24 'version="1.0">' + 25 '<xsl:output method="html"/>' + 26 '<xsl:variable name="rtf">1 <b>2</b> 3</xsl:variable>' + 27 '<xsl:template match="/">' + 28 '<xsl:copy-of select="exsl:node-set($rtf)"/>' + 29 '</xsl:template>' + 30 '</xsl:stylesheet>'; 31 var styleDoc = new DOMParser().parseFromString (style, "text/xml"); 32 33 var data = 34 '<root/>'; 35 var originalDoc = new DOMParser().parseFromString(data, "text/xml"); 36 37 processor.importStylesheet(styleDoc); 38 39 var fragment = processor.transformToFragment(originalDoc, document); 40 var content = document.getElementById("content"); 41 content.appendChild(fragment); 42 is(content.innerHTML, "1 <b>2</b> 3", 43 "Result of transform should be '1 <b>2</b> 3'"); 44 45 </script> 46 </pre> 47 </body> 48 </html>