3 ms·
As someone who is trying to learn XSLT, I totally agree that it is really hard to learn! It's a functional programming language (lisp-like) that you write with
by _aleph2c_ 4y ago
As someone who is trying to learn XSLT, I totally agree that it is really hard to learn! It's a functional programming language (lisp-like) that you write with verbose XML syntax. You operate over entire trees, your variables can't be changed and all of your functions are suppose to be written as tail recursions.
With this said, Michael Kay offers a nice series of patterns in chapter 17 of his book "XSLT 2.0 and XPath 2.0 Programmer's Reference". He shows how to use a "Fill-in-the-blanks" stylesheet that someone who only understands HTML can use, then he shows how to make a "Navigational Stylesheet", a "Rule-Based Stylesheet" and finally a "Computational Stylesheet". He shows that you don't necessarily need to use XSLT's functional programming powers, how you can get a lot with a little of it, and how to level up. So it seems like the language was designed to be written by people who don't understand it; it's declarative.
- spiralx 4y agoOnce you understand those three patterns it does get a bit simpler. I wrote a ton of XSLT and XQuery years back and it's incredibly powerful when used well, plus I wrote a nifty little stylesheet that transformed any HTML page into a formatted and highlighted version of itself :)