Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Because when you convert xslt to javascript it’s not xslt is it? It’s javascript pretending to xslt. Furthermore if you restrict rendering xslt to javascript then you lose all the performance benefits of xslt at the engine level.

Also if I’m going to be using Javascript why would I then reach for xslt instead of the other 8000 templating libraries.

All your “its fine to remove it” arguments only work if you ignore all the reasons it’s not fine to remove it. That’s awfully convenient.



You'd be replacing the native-implemented XSLT engine in the browser with a JavScript-implemented XSLT engine living in the JavaScript sandbox, not replacing XSLT with JavaScript.

There's a theorem with Turing's name on it that clarifies why that's equivalent.

> if you restrict rendering xslt to javascript then you lose all the performance benefits of xslt at the engine level.

Nowadays, I'd have to benchmark before just assuming the native implementation is faster. Especially if one of the issues is libxslt is under-maintained. JS is quite fast these days (and the polyfill investigated in the OP is wasm, not even JS). This problem can also be solved by moving the rendering server-side, in which case your ceiling for speed is much higher (and you're not spending your client's CPU on finishing the rendering of your page; added bonus in this era of mobile, battery-constrained devices).

> Also if I’m going to be using Javascript why would I then reach for xslt instead of the other 8000 templating libraries.

Great point. Why do we have this one arbitrary meta-language for declarative transformation of one datatype that's "blessed" with a native implementation? That's an odd corner-case, isn't it. We should probably simplify by putting it on-par with other solutions for that problem.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: