Remix.run Logo
afavour 2 days ago

Many years ago I tried very hard to go all-in on XML. I loved the idea of serving XML files that contain the data and an XSLT file that defined the HTML templates that would be applied to that XML structure. I still love that idea. But the actual lived experience of developing that way was a nightmare and I gave up.

"Developers keep making this bad choice over and over" is a statement worthy of deeper examination. Why? There's usually a valid reason for it. In this instance JSON + JS framework of the month is simply much easier to work with.

bilog 2 days ago | parent | next [-]

Most of the issues of using client-side XSLT is that browsers haven't updated their implementations since v1 nor their tooling to improve debugging. Both of these issues are resolved improving the implementations and tooling, as pointed out by several commenters on the GH issue.

FeepingCreature 2 days ago | parent [-]

That kind of demonstrates why XSLT is a bad idea as well though. JSON has its corner cases, but mostly the standard is done. If you want to manipulate it, you write code to do so.

_heimdall 2 days ago | parent [-]

JSON correlates to XML rather than XSLT. As far as I'm aware, XML as a standard is already done as well.

XSLT is more related to frontend frameworks like react. Where XML and JSON are ways of representing state, XSLT and react (or similar) are ways of defining how that state is converted to HTML meant for human consumption.

bilog 2 days ago | parent | next [-]

Also, fun fact, XSLT 3 relies on XPath 3.1 which can also handle JSON.

_heimdall 2 days ago | parent [-]

Ah, so it can! I've only ever used XSLT with built-in browser support, never even realized the latest would allow JSON to be rendered with XSLT!

FeepingCreature 2 days ago | parent | prev [-]

Yes but React is not built into the browser, that's kinda my point.

_heimdall 18 hours ago | parent [-]

XSLT is a browser spec and part of the web platform though, react never went through that process.

For what its worth, XSLT 3.0 can apparently work with JSON as well if your main concern from a couple comments up is XML vs JSON.

molteanu 2 days ago | parent | prev | next [-]

"Choice" is a big word here. It would imply "we've weighted the alternatives, the pros and cons, we've tested and measured different strategies and implementations and we came out with this conclusion: [...]." You know, like science and engineering.

While oftentimes what happens is is "oh, this thing seems to be working. And it looks easy. Great! Moving on.."

scotty79 a day ago | parent | prev | next [-]

XSLT is much nicer to use if you just create a very simple templating language that compiles to XSLT. Subset of XLST already has a structure of typical templating language. It can even be done with regexps. Then simplicity becomes a feature. You can write your page in pretty much pure HTML, or even pure HTML if you use comments or custom tags for block markers. Each template is simple and straightforward to write and read.

2 days ago | parent | prev [-]
[deleted]