| ▲ | dfabulich 7 hours ago |
| In part 1 of this article, the author wrote, "XSLT is an essential companion to RSS, as it allows the feed itself to be perused in the browser" Actually, you can make an RSS feed user-browsable by using JavaScript instead. You can even run XSLT in JavaScript, which is what Google's polyfill does. I've written thousands of lines of XSLT. JavaScript is better than XSLT in every way, which is why JavaScript has thrived and XSLT has dwindled. This is why XSLT has got to go: https://www.offensivecon.org/speakers/2025/ivan-fratric.html |
|
| ▲ | ndriscoll 7 hours ago | parent | next [-] |
| > JavaScript is better than XSLT in every way Obviously not in every way. XSLT is declarative and builds pretty naturally off of HTML for someone who doesn't know any programming languages. It gives a very low-effort but fairly high power (especially considering its neglect) on-ramp to templated web pages with no build steps or special server software (e.g. PHP, Ruby) that you need to maintain. It's an extremely natural fit if you want to add new custom HTML elements. You link a template just like you link a CSS file to reuse styles. Obvious. The equivalent Javascript functionality's documentation[0] starts going on about classes and callbacks and shadow DOM, which is by contrast not at all approachable for someone who just wants to make a web page. Obviously Javascript is necessary if you want to make a web application, but those are incredibly rare, and it's expected that you'll need a programmer if you need to make an application. Part of the death of the open web is that the companies that control the web's direction don't care about empowering individuals to do simple things in a simple way without their involvement. Since there's no simple, open way to make your own page that people can subscribe to (RSS support having been removed from browsers instead of expanded upon for e.g. a live home page), everyone needs to be on e.g. Facebook. It's the same with how they make it a pain to just copy your music onto your phone or backup your photos off of it, but instead you can pay them monthly for streaming and cloud storage. [0] https://developer.mozilla.org/en-US/docs/Web/API/Web_compone... |
| |
| ▲ | munificent 6 hours ago | parent | next [-] | | > XSLT is declarative and builds pretty naturally off of HTML for someone who doesn't know any programming languages. Have you ever met a single non-programmer who successfully picked up XSLT of their own volition and used it productively? I'd be willing to bet good money that the Venn diagram of users that fit the intersection of "authoring content for the web", "care about separating content from HTML", "comfortable with HTML", "not comfortable with JavaScript", and "able to ramp up on XSLT" is pretty small. At some point, we have to just decide "sorry, this use case is too marginal for every browser to maintain this complexity forever". | | |
| ▲ | basscomm 3 hours ago | parent | next [-] | | > Have you ever met a single non-programmer who successfully picked up XSLT of their own volition and used it productively? Hi! I'm a non-programmer who picked up XSLT of my own volition and spent the last five-ish years using it to write a website. I even put up all the code on github: https://github.com/zmodemorg/wyrm.org I spent a few weeks converting the site to use a static site generator, and there were a lot of things I could do in XSLT that I can't really do in the generator, which sucks. I'd revert the entire website in heartbeat if I knew that XSLT support would actually stick around (in fact, that's one of the reasons I started with XSLT in the first place, I didn't think that support would go away any time soon, but here we are) | | |
| ▲ | ndriscoll 3 hours ago | parent [-] | | For what it's worth, you can still run an XSL processor as a static generator. You of course lose some power like using document() to include information for a logged in user, but if it's a static site then that's fine. | | |
| |
| ▲ | matwood 5 hours ago | parent | prev | next [-] | | > Have you ever met a single non-programmer who successfully picked up XSLT of their own volition and used it productively? Admittedly this was 20ish years ago, but I used to teach the business analysts XSLT so they could create/edit/format their own reports. At the time Crystal Reports had become crazy expensive so I developed a system that would send the data to the browser as XML and then an XSLT to format the report. It provided basic interactivity and could be edited by people other than me. Also, if I remember, at the time it only worked in IE because it was the only browser with the transform function. | |
| ▲ | ndriscoll 6 hours ago | parent | prev | next [-] | | I was such a non-programmer as a child, yes. At the time that XSLT was new, if you read a book on HTML and making web pages from the library, it would tell you about things like separating content from styles and layout, yes. Things that blew my mind were that you could install Apache on your own computer and your desktop could be a website, or (as I learned many years later) that you could make a server application (or these days now Javascript code) that calls a function based on a requested path instead of paths being 1:1 with files. By contrast, like I said XSLT was just a natural extension of HTML for something that everyone who's written a couple web pages wants to do. The fact that the web's new owners have decided that making web pages is too marginal a use-case for the Web Platform is my point. | | |
| ▲ | ErroneousBosh 6 hours ago | parent [-] | | > it would tell you about things like separating content from styles and layout, yes. That's what CSS does. | | |
| ▲ | antod 4 hours ago | parent | next [-] | | XSLT is really separating (XML) data from markup in the case of the web. More generally it's transforming between different XML formats. But in the case of docs (eg XML-FO for docbook, DITA etc) XSLT does actually separate content from styling. | |
| ▲ | ndriscoll 6 hours ago | parent | prev [-] | | Yes that's why XSLT is such a natural fit when you learn about HTML+CSS. It's the same idea, but applied to HTML templates, which is something you immediately want when you hand-write HTML (e.g. navbars, headers, and footers that you can include on every page). | | |
| ▲ | ErroneousBosh 6 hours ago | parent [-] | | Your problem here is that you're hand-writing HTML including all the templates. This wasn't a good way to do it 30 years ago and it's not a good way to do it now. See all these "static site generators" everyone's into these days? We used those in the mid-90s. They were called "Makefiles". | | |
| ▲ | ndriscoll 6 hours ago | parent [-] | | Yeah because I was 11 and didn't know what a Makefile was. That's my point. I wanted to make web pages, and didn't know any programming. HTML is designed to be hand-written. You just write text, and when you want it to look different, you wrap it in a thing. When doing this, you'll quickly want to re-use snippets/invent your own tags. XSLT gives a solution to this without saying "okay let's back up and go learn how to use a command line now, and probably use an entirely different document format" (SSGs) or "okay let's back up and learn about functions, variables, classes, and callbacks, and maybe a compiler" (Javascript). It just says "when you want to make your own tags, extract them into a 'template' tag, then include your templates just like you include a CSS file for styles". |
|
|
|
| |
| ▲ | a456463 5 hours ago | parent | prev | next [-] | | I did. Just because the herd says it's dead doesn't mean XSLT is dead or "bad" | |
| ▲ | rendaw 6 hours ago | parent | prev | next [-] | | I've seen non-programmers learn SQL, and SQL is far more inconsistent, complex, non-orthogonal, fragmented, footgunny, and user hostile than most programming languages. I'm not sure what I mean by this, WRT XSLT vs Javascript. | |
| ▲ | jeffbee 6 hours ago | parent | prev | next [-] | | Funnily enough, XSLT is one of those things that I don't know very well but LLMs do. I find that I can ask Gemini to blurt out an XSLT implementation of my requirements given a snippet of example doc, and I have used this to good effect in some web scrapers/robots. | |
| ▲ | righthand 4 hours ago | parent | prev [-] | | I did after reading about it. I immediately moved my personal site to it and got rid of the crap JS site I had. |
| |
| ▲ | dfabulich 6 hours ago | parent | prev | next [-] | | XSL is a Turing-complete functional programming language, not a declarative language. When you xsl:apply-template, you're calling a function. Functional programming languages can often feel declarative. When XSL is doing trivial, functional transformations, when you keep your hands off of xsl:for-each, XSL feels declarative, and doesn't feel that bad. The problem is: no clean API is perfectly shaped for UI, so you always wind up having to do arbitrary, non-trivial transformations with tricky uses of for-each to make the output HTML satisfy user requirements. XSL's "escape hatch" is to allow arbitrary Turing-complete transformations, with <xsl:variable>, <xsl:for-each>, and <xsl:if>. This makes easy transformations easy and hard transformations possible. XSL's escape hatch is always needed, but it's absolutely terrible, especially compared to JS, especially compared to modern frameworks. This is why JS remained popular, but XSL dwindled. > It gives a low-effort but fairly high power (especially considering its neglect) on-ramp to templated web pages with no build steps or special server software (e.g. PHP, Ruby) that you need to maintain. It's an extremely natural fit if you want to add new custom HTML elements. JavaScript is a much better low-effort high-power on-ramp to templated web pages with no build steps or server software. JavaScript is the natural fit for adding custom HTML elements (web components). Seriously, XSLT is worse than JavaScript in every way, even at the stuff that XSLT is best at. Performance/bloat? Worse. Security? MUCH worse. Learnability / language design? Unimaginably worse. EDIT: You edited your post, but the Custom Element API is for interactive client-side components. If you just want to transform some HTML on the page into other HTML as the page loads, you can use querySelectorAll, the jQuery way. | | |
| ▲ | Mikhail_Edoshin 4 hours ago | parent | next [-] | | Come on. With XSLT you write a rule and then write a fragment of the resulting document. <xsl:template match="abc">
<def ghi="jkl"/>
</xsl:template>
This is one of simplest ways to do things. With JavaScript you what? Call methods? CreateElement("def").setAttribute("def", "jkl")
There is a ton of "template engines" (all strictly worse than XSLT); why people keep writing them? Why people invented JSX with all the complicated machinery if plain JavaScript is better? | |
| ▲ | James_K 6 hours ago | parent | prev [-] | | > Security? MUCH worse. This is patently false. It is much better for security if you use one of the many memory-safe implementations of it. This is like saying “SSL is insecure because I use an implementation with bugs”. No, the technology is fine. It's your buggy implementation that's the problem. | | |
| ▲ | ndriscoll 6 hours ago | parent [-] | | XSLT used as a pre-processor is obviously also a fundamentally better model for security because... it's used as a preprocessor. It cannot spy on you and exfiltrate information after page load because it's not running anymore (so you can't do voyeuristic stuff like capture user mouse movements or watch where they scroll on the page). It also doesn't really have the massive surface Javascript does for extracting information from the user's computer. It wasn't designed for that; it was designed to transform documents. |
|
| |
| ▲ | ErroneousBosh 6 hours ago | parent | prev | next [-] | | > not at all approachable for someone who just wants to make a web page If someone wants to make a web page they need to learn HTML and CSS. Why would adding a fragile and little-used technology like XSLT help? | | |
| ▲ | basscomm 3 hours ago | parent | next [-] | | > Why would adding a fragile and little-used technology like XSLT help? A few years ago I bought a bunch of Skylanders for practically nothing when the toys to life fad faded away. To keep track of everything I made a quick and dirty XSLT script that sorted and organized the list of figures and formatted each one based on their 'element'. That would have been murderous to do in plain HTML and CSS: https://wyrm.org/inventory/skylanders.xml | |
| ▲ | Mikhail_Edoshin 3 hours ago | parent | prev [-] | | Because you do not want to create web pages, but to render some information in the form of web pages. And as you write that information you make distinctions unique to a) this information and b) your approach to it. And one of the best ways to do this is to come up with a custom set of XML tags. You write about chess? Fine: invent tags to decribe parties, positions and moves. Or maybe a tutorial on Esperanto? Fine; invent a notation to highlight the lexical structure and the grammar. You can be as detailed as you want and at the same time you can ignore anything you do not care about. And then you want to merely render this semantically rich document into HTML. This is where XSLT comes in. |
| |
| ▲ | spankalee 6 hours ago | parent | prev | next [-] | | I'm a web components guy myself, but that's not the equivalent JavaScript functionality at all, as XSLT doesn't event have components. XSLT is a functional transform language. The equivalent JavaScript would be something like registry of pure functions of Node -> Node and associated selectors and a TreeWalker that walks the XML document, invokes matching functions, and emits the result into a new document. Or you could consume the XML as data into a set of React functions. | |
| ▲ | dist-epoch 4 hours ago | parent | prev [-] | | Nobody learned web programming by putting XSLT on top of XML. This is a fantasy world that does not exist. People used PHP, or a tool which created HTML (DreamWeaver), or a website, or maybe a LLM today. |
|
|
| ▲ | Pet_Ant 7 hours ago | parent | prev | next [-] |
| JavaScript is ever evolving and it means you need to stick to one of the two browsers (WebKit or Firefox) and keep upgrading. XSLT hasn't changed in years. It's an actual standard instead of an evolving one. I know that other independent browsers that I used to use back in the day just gave up because the pace of divergence pushed by the major implementations meant that it wasn't feasible to keep up independently. I still miss Konqueror. |
| |
| ▲ | pitaj 5 hours ago | parent [-] | | JavaScript is backwards compatible. You can use an older standard supported by everything if you wish. | | |
| ▲ | Pet_Ant 4 hours ago | parent [-] | | Really? Because I have an old iPad (4th gen?) that no longer works on many sites. If it was backwards compatible they'd still function. | | |
| ▲ | O4epegb 4 hours ago | parent | next [-] | | You are confusing backwards and forwards compatibility. Those sites may have added features that your iPad does not support, which is why it broke, if they have not added those, it might still work. However JS is not 100% backwards compatible either, it is in many cases, largely backwards compatible, but there are rare cases of bug fixes, or deprecated APIs that might be removed and break old code, but this is not even JS itself, it's more like web/engine standards. | |
| ▲ | demurgos 4 hours ago | parent | prev [-] | | You are talking about forward compatibility. JS is backwards compatible: new engines support code using old features. JS is not forward compatible: old engines don't support code using new features. Regarding your iPad woes, the problem is not the engine but websites breaking compat with it. The distinction matters as it means that once a website is published it will keep working. The only way to break an existing website is to publish a new version usually. The XSLT situation is note-worthy as it's an exception to this rule. |
|
|
|
|
| ▲ | skobes 6 hours ago | parent | prev | next [-] |
| Your link is just the abstract, I had to hunt for the full talk: https://www.youtube.com/watch?v=U1kc7fcF5Ao But it is quite interesting and especially learning about the security problems of the document() function (described @ 19:40-25:38) made me feel more convinced that removing XSLT is a good decision. |
|
| ▲ | kuschku 5 hours ago | parent | prev | next [-] |
| > Actually, you can make an RSS feed user-browsable by using JavaScript instead Say I have an XML document that uses XSLT, how do I modify it to apply your suggestion? I've previously suggested the XML stylesheet tag should allow <?xml-stylesheet type="application/javascript" href="https://example.org/script.js"?>
which would then allow the script to use the service-worker APIs to intercept and transform the request.But with the implementation available today, I see no way to provide a first-class XSLT-like experience with JS. |
|
| ▲ | LtWorf 5 hours ago | parent | prev | next [-] |
| No you can't, since opening an RSS feed won't run a javascript. |
|
| ▲ | throw_m239339 2 hours ago | parent | prev | next [-] |
| > by using JavaScript instead I think you're entirely missing the point of RSS by saying that. RSS doesn't and should require NOT Javascript. Now feeds could somehow be written in some bastard HTML5 directly, but please don't bring Javascript in that debate. XSLT allows to transform a XML document into an HTML presentation, without the need for javascript, that's its purpose. |
|
| ▲ | ErroneousBosh 6 hours ago | parent | prev [-] |
| > In part 1 of this article, the author wrote, "XSLT is an essential companion to RSS, as it allows the feed itself to be perused in the browser" Wow. I can see the proposed scrapping of XSLT being a huge problem for all of the seven people who do this. |