Top
Best
New

Posted by _kush 6 days ago

XSLT – Native, zero-config build system for the Web(github.com)
392 points | 324 commentspage 6
xg15 5 days ago|
I remember Blizzard actually using this concept for their battle.net site like, 10 years ago. I found it always really cool, but at some point I think they replaced it with a "regular" SPA stack.

I think one big problem with popularizing that approach is that XSLT as a language frankly sucks. As an architecture component, it's absolutely the right idea, but as long as actually developing in it is a world of pain, I don't see how people would have any incentive to adopt it.

The tragic thing is that there are other pure-functional XML transformation languages that are really well-designed - like XQuery. But there is no browser that supports those.

mdaniel 5 days ago|
> like XQuery

My favorite thing about XQuery is that it supports logically named functions, not just templates that happen to work upon whatever one provides it as with XSLT. I think golang's text/template suffers from the same problem - good luck being disciplined enough to always give it the right context, or you get bad outcomes

An example I had lying around:

  declare function local:find-outline-num( $from as element(), $num as xs:integer ) as element()* {
    for $el in $from/following-sibling::h:div[@class=concat('outline-', $num)]/*[local-name()=concat('h', $num)]
    return $el
  };
jonathaneunice 5 days ago||
Blast from the past:

"XSLT is a failure wrapped in pain"

original article seems offline but relevant HN discussion: https://news.ycombinator.com/item?id=8708617

kimi 5 days ago||
Just my two cents - the worst pieces of tech I ever worked with in my 40+ year career were Hibernate (second) and XSLT templating for an email templating system around 2005. Would not touch it with a stick if I can avoid it.
rpigab 5 days ago||
My first resume was in XSLT, because I didn't want to duplicate HTML tags and style around, it worked really well, and it was fun to see the xml first when clicking "view source".
meinersbur 5 days ago||
There is a classic DailyWTF about this technique: https://thedailywtf.com/articles/Sketchy-Skecherscom

> [...] the idea of building a website like this in XML and then transforming it using XSL is absurd in and of itself [...]

In the comments the creators comment on it, like that it was a mess to debug. But I could not find anything wrong with the technique itself, assuming that it is working.

jcmeyrignac 5 days ago|
There are 2 main problems with XSLT. The first one is that manipulating strings is a pain. Splitting strings, concatenating them is verbose like hell and difficult to read. The second one is that it quickly becomes a mess when you use the "priority" attribute to overload functions. I compare XSLT to regular expressions, with great flexibility but impossible to maintain due to poor readability. To my knowledge, it's impossible to trace.
shireboy 5 days ago||
My first intranet job early 2000s reporting was done this way. You could query a db via asp to get some xml, then transform using xslt and get a big html report you could print. I got pretty good at xslt. Nowadays I steer towards a reporting system for reports, but for other scenario you’re typically doing one of the stacks he mentioned: JSON or md + angular/vue/react/next/nuxt/etc

I’ve kinda gotten to a point and curious if others feel same: it’s all just strings. You get some strings from somewhere, write some more strings to make those strings show other strings to the browser. Sometimes the strings reference non strings for things like video/audio/image. But even those get sent over network with strings in the http header. Sometimes people have strong feelings about their favorite strings, and there are pros and cons to various strings. Some ways let you write less strings to do more. Some are faster. Some have angle brackets, some have curly brackets, some have none at all! But at the end of the day- it’s just strings.

tokinonagare 5 days ago|
My first personal page was made this way too. Nightmare to debug, since "view source" only gave the XML code, not the computed XHTML.
Dachande663 6 days ago||
Many, many years back I used Symphony21[0] for an events website. It’s whole premise was build an XML structure via blueprints and then your theme is just XSLT templates for pages.

Gave it up because it turns out the little things are just a pain. Formatting dates, showing article numbers and counts etc.

[0] https://www.getsymphony.com/

k4runa 6 days ago|
Wow, blast from the past.
codelikeawolf 5 days ago||
I know XML and XSLT gets a lot of hate. To some extent, the hate for XSLT is warranted. But I have to work with XML files for my job, and it was pretty refreshing to not have to install any libraries to work with them in a web app. We use XML as the serialization format for a spaceflight mission planning app, so there's a lot of complex data that would be trickier to represent with JSON. At the end of the day, HTML is spicy XML, so you can use all the native web APIs to read/write/query/manipulate XML files and even apply XSLT transformations.

I suspect some of the hate towards XML from the web dev community boils down to it being "old". I'll admit that used to have the same opinion until I actually started working with it. It's a little bit more of a PITA than working with JSON, but I think I'm getting a much more expressive and powerful serialization format for the cost of the added complexity.

nashashmi 5 days ago|
Do you find it wrong that the XML needs to call the XSL instead of vice versa? As in XSLT calling XML data?
Hendrikto 6 days ago|
I hate this grug brain writing style. It sounds bad and is hard to read. Please just write normal, full sentences.
jurip 6 days ago||
Yeah I don't get it. I had to stop reading after a couple of sentences, I just can't deal with that.
antonvs 6 days ago|||
Presumably part of the goal is to implicitly claim that what's being described is so simple a caveman could understand it. But writing such a post about XSLT is like satire. Next up, grug brain article about the Coq proof assistant?
s4i 6 days ago||
Maybe it’s just the way the author writes?
More comments...