Hacker News new | ask | show | jobs
by jeroenhd 44 days ago
Semi-serious suggestion: wrap the files in an (X)HTML page that links to a Javascript file loading a full XML parser compiled to WebAssembly, which then does the full transformation live, in-browser. You wouldn't need to change your templates or your generation logic much if you structure the surrounding skeleton right!

Of course, you'd need to get over the lunacy of loading a full DOM transformation library into the browser DOM.

1 comments

you also need to get over the fact that this doesn't work while disabling javascript, while built in xslt doesn't need javascript. on the other hand though it's not a big loss given that xslt isn't any safer. anyone who turns off javascript probably ought to have turned of xslt as well.

but that just aside. the last time this was discussed a year ago i actually tried to find a working solution to load xslt through javascript and could not find any.

i only got as far as verifying that js can be loaded from an xml mimetype. xslt implementations in js also exist. what's missing is the wrapper code to load the xslt library and run it over the xml and xslt files.

perhaps now with this seriously being needed by a few sites someone will have the time to get this working.

My thought wasn't so much "do XSLT parsing in Javascript" and more "compile a C program to apply XSLT transformations using emscriptem and embed that". You can probably throw that concept into any slop machine and get a cursed compatibility library out of it.