1941002-2.html (1659B)
1 <html class="reftest-wait"> 2 <body> 3 <script> 4 function checkEvents(test, callback) { 5 const detailsElement = document.getElementById("detailsElement"); 6 detailsElement.addEventListener("toggle", callback, { once: true }); 7 detailsElement.setAttribute("open", ""); 8 9 test(); 10 11 detailsElement.removeAttribute("open"); 12 } 13 14 const xmlString = `<foo><bar/></foo>`; 15 const xsltString = ` 16 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 17 <xsl:param name="p" /> 18 <xsl:template match="/"> 19 <xsl:for-each select="$p/bar"> 20 <xsl:copy-of select="." /> 21 <xsl:copy-of select="document('1941002.sjs')/xsl:stylesheet"/> 22 </xsl:for-each> 23 </xsl:template> 24 </xsl:stylesheet> 25 `; 26 const paramString = ` 27 <foo> 28 <bar>p1</bar> 29 <bar>p2</bar> 30 <bar>p3</bar> 31 <bar>p4</bar> 32 </foo> 33 `; 34 35 const parser = new DOMParser(); 36 const xmlDoc = parser.parseFromString(xmlString, "application/xml"); 37 const xsltDoc = parser.parseFromString(xsltString, "application/xml"); 38 const xsltProcessor = new XSLTProcessor(); 39 40 xsltProcessor.setParameter(null, "p", parser.parseFromString(paramString, "application/xml").documentElement); 41 42 addEventListener("load", () => { 43 xsltProcessor.importStylesheet(xsltDoc); 44 45 checkEvents(() => { 46 xsltProcessor.transformToFragment(xmlDoc, document); 47 }, () => { 48 xsltProcessor.clearParameters(); 49 SpecialPowers.forceGC(); 50 SpecialPowers.forceCC(); 51 }); 52 53 document.documentElement.classList.remove("reftest-wait"); 54 }); 55 </script> 56 <details id="detailsElement"></details> 57 </body> 58 </html>