test_bug551654.html 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 type="application/javascript" 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. </div>
  16. <pre id="test">
  17. <script type="application/javascript">
  18. /** Test for Bug 551654 **/
  19. var didTransform = false;
  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:template match="/">' +
  27. '<xsl:copy-of select="exsl:node-set(42)"/>' +
  28. '</xsl:template>' +
  29. '</xsl:stylesheet>';
  30. var styleDoc = new DOMParser().parseFromString (style, "text/xml");
  31. var data =
  32. '<root/>';
  33. var originalDoc = new DOMParser().parseFromString(data, "text/xml");
  34. processor.importStylesheet(styleDoc);
  35. var fragment = processor.transformToFragment(originalDoc, document);
  36. is(fragment.firstChild.nodeType, Node.TEXT_NODE,
  37. "Result of transform should be a textnode");
  38. is(fragment.firstChild.nodeValue, "42",
  39. "Result of transform should be a textnode with value '42'");
  40. </script>
  41. </pre>
  42. </body>
  43. </html>