3 ms·
I worked with XSLT for a few years a while ago, it's functional not procedural and that's the brainfuck you need to get your head around. It was also missing wh
by mattmanser 13y ago
I worked with XSLT for a few years a while ago, it's functional not procedural and that's the brainfuck you need to get your head around. It was also missing what seemed like basic functionality, like mutable variables.
We used to automatically convert SQL queries into XML using the AS column naming (like SELECT p.Id, p.Name, k.Id [kids\kid\@Id], k.Name [kids\kid\Name] FROM Person p JOIN Kids k ON k.FatherId = p.Id).
Then we could transform server-side to send down the HTML as well as do client-side updates in javascript by sending XML and the running the XSLT clientside to do partial updates (you can specify which part of the XSLT you want to run).
Worked pretty well as at the time, most browsers ran XSLT much faster than they ran Javascript.
I even got a pretty funky pivot table working in it that could handle 10,000s of rows when in javascript it would die after a 1,000 (we're talking IE6/7 era here).
There's actually a Daily WTF article where someone posted Sketchers.com's use of XSLT as a WTF and a lot of people chimed in in the comments that they did this and it was actually really good and not a WTF at all:
http://thedailywtf.com/Articles/Sketchy-Skecherscom.aspx http://thedailywtf.com/Articles/Sketchy-Skecherscom.aspx
Note the featured comment was a response from the lead dev!
As for what situations in industry, our use was pretty uncommon as you can see from the WTF, but it's often used to transform XML in one format to another so they can get different systems actually talking to each other.