Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<html class="reftest-wait">
<body>
<script>
function checkEvents(test, callback) {
const detailsElement = document.getElementById("detailsElement");
detailsElement.addEventListener("toggle", callback, { once: true });
detailsElement.setAttribute("open", "");
test();
detailsElement.removeAttribute("open");
}
function destroyElement(doc) {
doc.removeChild(doc.documentElement);
SpecialPowers.forceGC();
SpecialPowers.forceCC();
}
const xmlString = `<foo><bar/></foo>`;
const xsltString = `
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="1941002.sjs"/>
<xsl:template match="/">
<xsl:copy-of select="foo|(document('1941002.sjs')/xsl:stylesheet)"/>
</xsl:template>
</xsl:stylesheet>
`;
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlString, "application/xml");
const xsltDoc = parser.parseFromString(xsltString, "application/xml");
const xsltProcessor = new XSLTProcessor();
addEventListener("load", () => {
checkEvents(() => {
xsltProcessor.importStylesheet(xsltDoc);
}, () => { destroyElement(xsltDoc); });
checkEvents(() => {
xsltProcessor.transformToFragment(xmlDoc, document);
}, () => { destroyElement(xmlDoc); });
document.documentElement.classList.remove("reftest-wait");
});
</script>
<details id="detailsElement"></details>
</body>
</html>