test_bug551654.html (1494B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=551654 5 --> 6 <head> 7 <title>Test for Bug 551654</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=551654">Mozilla Bug 551654</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 16 </div> 17 <pre id="test"> 18 <script type="application/javascript"> 19 20 /** Test for Bug 551654 */ 21 22 var didTransform = false; 23 var processor = new XSLTProcessor(); 24 var style = 25 '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ' + 26 'xmlns:exsl="http://exslt.org/common" ' + 27 'version="1.0">' + 28 '<xsl:output method="html"/>' + 29 '<xsl:template match="/">' + 30 '<xsl:copy-of select="exsl:node-set(42)"/>' + 31 '</xsl:template>' + 32 '</xsl:stylesheet>'; 33 var styleDoc = new DOMParser().parseFromString (style, "text/xml"); 34 35 var data = 36 '<root/>'; 37 var originalDoc = new DOMParser().parseFromString(data, "text/xml"); 38 39 processor.importStylesheet(styleDoc); 40 var fragment = processor.transformToFragment(originalDoc, document); 41 is(fragment.firstChild.nodeType, Node.TEXT_NODE, 42 "Result of transform should be a textnode"); 43 is(fragment.firstChild.nodeValue, "42", 44 "Result of transform should be a textnode with value '42'"); 45 46 </script> 47 </pre> 48 </body> 49 </html>