top | item 44634754

(no title)

palsecam | 7 months ago

Oh but yes, Firefox (and Chrome) do support XSLT natively! See https://paul.fragara.com/feed.xml as an example (the Atom feed of my website, styled with XSLT).

FTR, there’s also XSLTProcessor (https://developer.mozilla.org/en-US/docs/Web/API/XSLTProcess...) available from Javascript in the browser. I use that on my homepage, to fetch and transform-to-HTML said Atom feed, then embed it:

  const atom = new XMLHttpRequest, xslt = new XMLHttpRequest;
  atom.open("GET", "feed.xml"); xslt.open("GET", "atom2html.xsl");
  atom.onload = xslt.onload = function() {
    if (atom.readyState !== 4 || xslt.readyState !== 4) return;
    const proc = new XSLTProcessor;
    proc.importStylesheet(xslt.responseXML);
    const frag = proc.transformToFragment(atom.responseXML, document);
    document.getElementById("feed").appendChild(frag.querySelector("[role='feed']"));
  };
  atom.send(); xslt.send();
Server-side, I’ve leveraged XSLT (2.0) in the build process of another website, to slightly transform (X)HTML pages before publishing (canonicalize URLs, embed JS & CSS directly in the page, etc.): https://github.com/PaulCapron/pwa2uwp/blob/master/postprod.x...

discuss

order

johannes1234321|7 months ago

Interesting, it's more than 20 years since I tried anything in that space. Thanks for the correction.