Hacker News
points by ajasmin 3 days ago | 0 comments
Aren't browsers implementations of the XSLT and XPATH standards really out of date to start with?

What would be a modern equivalent of a JSON to HTML transformer?

[–] pornel 3 days ago
They are (were), and the implementation was poor anyway - the transform is not dynamic, and not even progressive. It's just a high-latency legacy static templating engine you can't upgrade.
[–] daylily 3 days ago
JSON is much easier to directly access and manipulate in JS compared to XML, so I think you'd just fetch() it directly and then plug the data into something like lit-html. Which probably doesn't need bundling either since it's just template functions.
[–] Timwi 3 days ago
> JSON is much easier to directly access and manipulate in JS compared to XML

That doesn't sound like a hard thing to fix? JS already comes with a ton of APIs and “web technologies”, but creating an XML equivalent to JSON.parse/JSON.stringify is somehow outside the realm of the thinkable?

[–] pmarreck 3 days ago
> JSON is much easier to directly access and manipulate in JS compared to XML

and yet a single newline in a text field will shatter its validity or force you to enter escaping-hell.

(I tamed that entire general problem by making https://github.com/pmarreck/printable_binary, and it will permit you to pack all binary data into a string, without any escaping issues, while retaining ascii legibility, although that requires a decoding step.)

[–] Joker_vD 3 days ago
> and yet a single newline in a text field will shatter its validity or force you to enter escaping-hell.

So would a single & or > in the body of an XML element, you know.