Rather than singing the praise of XSLT (which I love) I'll show an example: this tool transforms any rich text to markdown: http://markitdown.medusis.com It's about 30 lines of XSLT that run in the browser. [Edit: it's not 30 lines but 230, but I was thinking of the number of "rules" (templates) of which there are only 29.] There are very few other tools of its kind and I don't think there exists any client-side, wit…
Looks like 230 lines to me https://github.com/bambax/markitdown.medusis.com/blob/master...
XSLT is a failure wrapped in pain
11–20 of 157 posts
Re: XSLT is a failure wrapped in pain
#12XSLT is one of the most powerful and elegant technologies created in the last 15 years. Those who don't understand it and that's why can't use it, should just do their home work and learn better
My definition of powerful and elegant is lisp XML is just death by overengineering
XML might be overengeneered (which, except for a few things I don't agree with), but there is currently no alternative for it.
Re: XSLT is a failure wrapped in pain
#13XSLT is one of the most powerful and elegant technologies created in the last 15 years. Those who don't understand it and that's why can't use it, should just do their home work and learn better
My definition of powerful and elegant is lisp XML is just death by overengineering
> My definition of powerful and elegant is lisp
Dude, XML is just s-exprs and XSLT is macros.Re: XSLT is a failure wrapped in pain
#14Rather than singing the praise of XSLT (which I love) I'll show an example: this tool transforms any rich text to markdown: http://markitdown.medusis.com It's about 30 lines of XSLT that run in the browser. [Edit: it's not 30 lines but 230, but I was thinking of the number of "rules" (templates) of which there are only 29.] There are very few other tools of its kind and I don't think there exists any client-side, wit…
It looks like 234 lines of code to me.
>This attempt for example https://github.com/domchristie/to-markdown/blob/master/src/t....
Is badly written, but still written in a better language. They're using regexps to parse HTML (omfg!), but that kind of nastiness doesn't excuse XSLT as a language.
>There is no better templating language than XSLT
Except mako, jinja2, django templating language, liquid, etc.
Re: XSLT is a failure wrapped in pain
#15JSON/Javascript is just easier to learn and work with than XML/XSLT. For starters, you don't need to learn a special language that you'll never use for anything else. Just in case you /do/ need to use XML every day: the primary benefit of XSLT is that it lets you avoid using XML libraries to munge some XML. Because the XML libraries are so horrendous to use from any language.
Re: XSLT is a failure wrapped in pain
#16Quote
> I'm not even talking about the hideously verbose syntax, or the completely obtuse data model. The fact that you can't know what any single line of code does without reviewing every other line in the program makes this language an abomination.
Re: XSLT is a failure wrapped in pain
#17XSLT is one of the most powerful and elegant technologies created in the last 15 years. Those who don't understand it and that's why can't use it, should just do their home work and learn better
The problem is that it's often misused. Using an XSLT that takes 0.5s to run to transform some XML to HTML during web requests on a busy site? Idiotic. Using it for async transformations - html to pdf, customer message format to your message format. Fine.
Re: XSLT is a failure wrapped in pain
#18Rather than singing the praise of XSLT (which I love) I'll show an example: this tool transforms any rich text to markdown: http://markitdown.medusis.com It's about 30 lines of XSLT that run in the browser. [Edit: it's not 30 lines but 230, but I was thinking of the number of "rules" (templates) of which there are only 29.] There are very few other tools of its kind and I don't think there exists any client-side, wit…
http://markitdown.medusis.com/xsl/html2mk.xsl It looks like 234 lines of code to me. >This attempt for example https://github.com/domchristie/to-markdown/blob/master/src/t... . Is badly written, but still written in a better language. They're using regexps to parse HTML (omfg!), but that kind of nastiness doesn't excuse XSLT as a language. >There is no better templating language than XSLT Except mako, jinja2, django…
"written in a better language" doesn't mean much, however. A better language for what? I'm not picking on JavaScript, which I love and use every day; but templating in JS versus XSLT is crazy.
The templating languages that you mention are, in my opinion, extremely complex and very unpalatable; and they only work server-side.
But that's all a matter of taste, I guess. What I don't understand is why so many people go out of their way to declare their hate of XSLT (and all things XML), especially now that XSLT is all but dead...?
Re: XSLT is a failure wrapped in pain
#19Earlier quoted context omitted.
My definition of powerful and elegant is lisp XML is just death by overengineering
apples and oranges? There is no other way of encoding structured documents these days than XML. Like it or not, XML is the de facto standard for data exchange (export from databases, product information software,....) XML might be overengeneered (which, except for a few things I don't agree with), but there is currently no alternative for it.
Re: XSLT is a failure wrapped in pain
#20Angle bracket overload, verbosity of end tags, library support, poor whitespace handling, namespace pain were all obstacles too but it was FP that made standard problems feel like math proofs and for developers to take days to solve problems they could code in minutes in their usual OO/imperative language.
When I see the pain FP causes in the real world I'm never quite sure whether its nature or nurture. I currently believe its a bit of both but the nature part will always hobble FP adoption - if you find algebraic proofs elegant, you will like FP. If you are "normal" and proving a theorem fills you with terror then you would prefer your programming language to resemble a a cookery recipe.
I also believe all templating, especially for code-generation, requires three brains - understanding the input data-structure, understanding the processing of the template and understanding the behaviour of the output. Each keystroke in your templating language has to be carried out with full understanding of all three parts. Its too much for those if they still struggle with more common two brain programming problems.