demo · v143

XSLT Removal

Two probes: does this browser still have XSLTProcessor, and does it still apply <?xml-stylesheet?>? Plus a working JS replacement — render the same data using a template literal instead of XSL.

feature probes

window.XSLTProcessor

Checking…

processor.transformToFragment runs

Tries a tiny inline XSL transform.

the replacement: template-driven rendering

Edit the data. The HTML re-renders via JS — no XSLT involved.

the replacement code

// XSLT replacement: parse XML, render with a JS template.
const xml = new DOMParser().parseFromString(xmlText, "application/xml");
const books = [...xml.querySelectorAll("book")];
container.innerHTML = books.map((b) => `
  <article>
    <h3>${b.getAttribute("title")}</h3>
    <p>${b.getAttribute("author")} · ${b.getAttribute("year")}</p>
  </article>`).join("");

see also