Top
Best
New

Posted by _kush 5 days ago

XSLT – Native, zero-config build system for the Web(github.com)
391 points | 324 commentspage 5
tannhaeuser 5 days ago|
I had done a couple of nontrivial projects with XSLT at the time and the problem with it is its lack of good mnemonics, discoverability from source code, and other ergonomics coupled with the fact that it's only used rarely so you find yourself basically relearning after having not used it for a couple of weeks. Template specifity matching is a particularly bad idea under those circumstances.

XSLT technically would make sense the more you're using large amounts of boilerplate XML literals in your template because it's using XML itself as language syntax. But even though using XML as language meta-syntax, it has lots of microsyntax ie XPath, variables, parameters that you need to cram into XML attributes with the usual quoting restrictions and lack of syntax highlighting. There's really nothing in XSLT that couldn't be implemtented better using a general-purpose language with proper testing and library infrastructure such as Prolog/Datalog (in fact, DSSSL, XSLT's close predecessor for templating full SGML/HTML and not just the XML subset, was based on Scheme) or just, you know, vanilla JavaScript which was introduced for DOM manipulation.

Note maintainance of libxml2/libxslt is currently understaffed [1], and it's a miracle to me XSLT (version v1.0 from 1999) is shipping as a native implementation in browsers still unlike eg. PDF.js.

[1]: https://gitlab.gnome.org/GNOME/libxml2/-/issues/913

ako 5 days ago||
I built an actual shipping product that used this approach over 25 years ago. The server would have the state of every session, that would be serialized to xml, and then xslt templates would be used to render html. Idea was that this would allow customers to customize the visual appearance of the webpages, but xslt was too difficult. Not a success.
xhrpost 5 days ago|
I did something like this at an employer a while ago as well. Taking it a step further, we wanted to be able to dynamically build the templates that the browser would then use for building the HTML. Senior dev felt the best way would be to have a "master" xslt that would then generate the xslt for the browser. I ended up building the initial implementation and it was a bit of a mind bender. Fun, but not developer friendly for sure .
alganet 5 days ago||
I remember learning XSLT from this:

https://zvon.org/xxl/XSLTutorial/Books/Output/contents.html

Still a great resource.

--

I would say CSS selectors superseeded XPath for the web. If one could do XSLT using CSS selectors instead, it would feel fresh and modern.

chrismorgan 5 days ago||
I’m disappointed that this uses a custom XML format, rather than RSS (tolerable) or Atom (better). Then you could just drop it into a feed reader fine.

A few years ago, I decided to style my own feeds, and ended up with this: https://chrismorgan.info/blog/tags/fun/feed.xml. https://chrismorgan.info/atom.xsl is pretty detailed, I don’t think you’ll find one with more comprehensive feature support. (I wrote a variant of it for RSS too, since I was contemplating podcasts at the time and almost all podcast software is stupid and doesn’t support Atom, and it’s all Apple’s fault: https://temp.chrismorgan.info/2022-05-10-rss.xsl.)

At the time, I strongly considered making the next iteration of my website serve all blog stuff as Atom documents—post lists as feeds, and individual pages as entries. In the end, I’ve decided to head in a completely different direction (involving a lot of handwriting!), but I don’t think the idea is bad.

Lex-2008 5 days ago|
Hey, thanks a lot for the atom.xsl! Used it to learn a lot while converting main page of my blog to an Atom feed half a year ago.
patwolf 5 days ago||
I'm old enough to remember when Google released AJAXSLT in 2005. It was a JS implementation of XSLT so that you could consistently use XSLT in the browser.

The funny thing is that the concept of AJAX was fairly new at the time, and so for them it made sense that the future of "fat" web pages (that's the term they use in their doc) was to use AJAX to download XML and transform it. But then people quickly learned that if you could just use JS to generate content, why bother with XML at all?

Back in 2005 I was evaluating some web framework concepts from R&D at the company I worked, and they were still very much in an XML mindset. I remember they created an HTML table widget that loaded XML documents and used XPATH to select content to render in the cells.

aarroyoc 5 days ago||
It's worth mentioning that current XSLT version is 3.0 but browsers are only compatible with XSLT 1.0
thom 5 days ago||
XSLT was many people’s first foray into functional programming (usually unwilling, because their company got a Google Search Appliance or something). I can’t imagine ever reaching for it again personally, but it was useful and somewhat mind-expanding in its heyday.
bambax 5 days ago|
I made many transformation pipelines with XSLT back in the days, and even a validation engine using Schematron; it was one of the most pleasant experience I had.

It never broke, ever.

It could have bugs, of course! -- but only "programmer bugs" (behavior coded in a certain way that should have been coded in another); it never suddenly stopped working for no reason like everything does nowadays.

CamouflagedKiwi 5 days ago||
I worked with XSLT a few companies ago. They had several XSLT documents as a transformation to various output formats (this was a pretty minor part of the overall product).

I'm not sure I've ever seen something less popular. Feature requests and the odd bug would build up, eventually an engineer would be assigned to it for a week and they'd fix a bunch of things, then essentially would rather quit than keep doing it, so next time it'd be someone else's turn.

I don't even think it was particularly bad. It seemed like it was just always like that. Thank goodness it isn't so popular any more so it doesn't turn up jammed into random places as it did then.

riedel 5 days ago||
Funnily back in the 90s working as a webdesigner in my high school years (whatever you would call web design these days), I remember building a DSSSL- dialect based pipeline to generate websites from a newsfeed published. I still like XSLT transformations. I even used the bananas XI reader [0] to transform actual text using XSLT for transforming and templating . I have, however, met few people that also appreciated this. Often such tooling was replaced once someone else took over the job...

[0] http://www.ananas.org/xi/

samuell 5 days ago|
In the early 2000s, XSLT allowed me as a late teenager with some HTML experience but without real coding skills (I could copy some lines of PHP from various forums and get it to work) to build a somewhat fancy intranet for a local car shop, complete with automatic styling of a feed of car info from a nationwide online sales portal.

Somehow it took me many years, basically until starting uni and taking a proper programming class, before I started feeling like I could realize my ideas in a normal programming language.

XSLT was a kind of tech that allowed a non-coder like me to step by step figure out how to get things to show on the screen.

I think XSLT really has some strong points, in this regard at least.

samuell 5 days ago|
In later years, I returned to XSLT to try parsing a structured text format for tool definitions in the Galaxy bioinformatics platform.

Turns out you can do a lot with the RegEx-support in XSLT 2.0!

https://saml.rilspace.com/exercise-in-xslt-regex-partial-gal...

The result? A Java-based tools for creating CLI commands via a wizard:

https://www.youtube.com/watch?v=WMjXsBVqp7s

More comments...