« BackA look at XSLT 3.0 (2017)xml.comSubmitted by protomolecool 7 days ago
  • JoshTriplett 3 days ago

    Decades ago, I worked on the XCB library (the replacement for Xlib). I replaced the M4 macros used to generate all the X protocol bindings with XML protocol definitions and XSLT to do code generation.

    The XML turned out extremely well, and it's still being used today, such as for bindings in several other languages.

    Someone rewrote my XSLT in Python, and I cheered them on, because the result was much more readable, not least of which because the fundamentally procedural steps could be written in a procedural language with a good syntax, rather than XSLT's pure-functional language that suffered from being embedded in XML.

    • mcswell 3 days ago

      Well said. I once had the displeasure of trying to write some code in XSLT (it had to fit in with existing XSLT code). It had to be the worst programming language I'd ever seen, with the possible exception of assembler. First, who decided that XML was a good format to write a programming language in? Punch cards would have been better. And second, trying to debug it was embarrassingly difficult.

      • xyz_opinion 3 days ago

        XSLT is not a programming language. It's a declarative transform for XML, and when you need such a thing, it is extremely useful.

      • aleph_minus_one 3 days ago

        > And second, trying to debug it was embarrassingly difficult.

        I remember that in the past Visual Studio had a pretty decent debugger for XSLT.

    • hackrmn 3 days ago

      Is XSLT enjoying the equivalent of Streisand Effect? Ever since news came out of Google wanting to rid Chrome of XSLT support, there has been a number of XSLT-related news here. I am not complaining, I think XSLT deserves a second life, it hasn't had the scrutiny it deserves, nor its "15 years of fame".

      • chrismorgan 3 days ago

        That’s basically what happened with MathML a decade ago. Chromium had briefly had an implementation (M24 alone!), Firefox had an excellent implementation, and Safari had a decent implementation; there was very little usage. Chromium proposed removing it. There was much kerfuffle. When the dust settled, MathML won. MathML Core was defined, Igalia contributed a robust MathML implementation to Chromium, Safari tightened their implementation up, and people started actually using it a lot more.

        Around the same time, Google tried to deprecate SMIL (SVG animation tech), which would probably have led to its removal after some time. This also failed, and it’s used more than it was then (though CSS animations are probably quite a bit more popular, and have over time become more capable), probably because now all engines support it robustly (MSHTML and EdgeHTML never did).

        I hope that we’ll get a more formal commitment to XML and XSLT, and XSLT 3 in browsers, out of this.

        • DaiPlusPlus 3 days ago

          As an aside, I note that MSHTML supported “HTML+TIME” (anyone remember Vizact?).

        • tptacek 3 days ago

          It wasn't Google. The original proposal came from Mozilla, and apparently all the browser vendors want to be rid of it.

          • chrismorgan 3 days ago

            Browser makers trying to kill XSLT is not new: Chrome had intents to deprecate and remove XSLT in 2013 and 2015 (which both failed).

            Each time so far, there’s been movement for a while, significant pushback, and the one who was championing removal realises it’s hard, and quietly drops it. Smaug from Mozilla bringing it up at a WHATNOT meeting a few months ago looked like it was heading the same way, a “yeah, we’d kinda like to do this, but… meh, see what happens”. Then a few months later Mason Freed of Google decided to try championing it. We’ll see where things go.

            • tptacek 3 days ago

              Which part of what I said was false?

              • pmontra 3 days ago

                Why should the presence of replies to your comment mean that they don't agree with you? Sometimes replies add more context or are simply elaborated me-toos.

                • saghm 3 days ago

                  I think that's the exact point the parent commenter is trying to make. One person said Google has wanted to get rid of XSLT for years, which someone else responded to saying that it was Mozilla who made this proposal, and then someone else responded with details about Google's history of wanting to get rid of it previously, at which point the question around what part of the second comment been untrue entered the picture. That question doesn't make a ton of sense, because if the reply to the second comment was assumed to be disagreement, the same logic would presumably apply to the second comment itself, so the question "what part is untrue?" would be just as valid to ask about the "disagreement" with the original statement that Google has wanted to get rid of XSLT for years.

                  Of course, I could be making the same mistake in reading your comment as expressing disagreement with the one you're responding to! If that's not the case, then I'll happily accept my mistake so the chain can hopefully stop here.

                  (edit: I'm realizing now that this definitely is my own mistake, as I misread which comment this one was replying to. I might need to invest time in finding a new app for reading HN on mobile, since the indentation levels on the one I've been using clearly aren't large enough for my terrible eyesight...)

                  • guerrilla 3 days ago

                    This is a good comment and there is an answer to your question. I know because I react the same way sometimes. It's about insecurity. They're interpreting it as negative by default either because they've been treated poorly before or because they have low self-esteem. Either way, their state shapes their expectations.

                  • cxr 3 days ago

                    There's a perverse irony to responding like this (besides the fact that no one, whether implicitly or explicitly, said anything like, "That's not true"), since the comment you replied to merely mentioned "Google wanting to rid Chrome of XSLT support", which you indicated was untrue. Which part, exactly?

                • josefx 3 days ago

                  > came from Mozilla

                  Maybe they should stop wasting money on pointless, proprietary side tangents before they set out to break standards.

                • Klonoar 3 days ago

                  It’s a parallel universe Lisp/Rust as far as HN goes.

                  • fuckaj 3 days ago

                    [dead]

                    • undefined 3 days ago
                      [deleted]
                    • roadside_picnic 3 days ago

                      There are many things I don't love about how tech has evolved, but when I look at a massive blob of XML and a lengthy explanation of "why this is better than just writing code!" I feel a little a bit more accepting of the current state of things.

                      • lenkite 3 days ago

                        I find massive blobs of XML easier to grok than massive blobs of JSON, esp well-designed XML with namespaces and use of attributes. XML is self documenting.

                        JSON is just a homogeneous unnamed bunch of braces and key-val pairs that you loose yourself in once you are several MB in and deeply nested. Need to resort to CLI tools like jq or hunt for the schema or docs.

                        Massive blobs of YAML, well - they should be simply categorized as a war-crime.

                        • arcfour 3 days ago

                          Hell, you can parse XML and infer complex types! Good luck doing that with JSON though.

                        • wrs 3 days ago

                          Sure, it's so much better to be writing massive blobs of YAML.

                          There just seems to be some misguided human impulse to take every data serialization language and force it to be a programming language, instead of just using a programming language.

                          • jact 3 days ago

                            It is “just code.” It’s good at what it does too.

                            Although for my purposes, I find myself reaching for xquery a lot more often which is a very good and elegant programming language and template language although it was billed as “SQL for XML.”

                            • _heimdall 3 days ago

                              XML and XSLT are a bad fit in many common uses, that's why the argument is frustrating. If you are almost always working with projects where you own the frontend and the backend, just stick with JSON and RPC.

                              • Telemakhos 3 days ago

                                If you’re only using XML for AJAX style communication of fragments of data between a model and view, sure, use JSON or whatever. If, on the other hand, you’re encoding a representation of a text and need to mark it up to indicate bibliographic features and textual variation between editions, you need TEI XML. If you want a dataset to be available in a machine-readable format at a particular address and also have that data look good for humans, you want XML. XML is for more than passing messages from a backend to a frontend.

                                • _heimdall 3 days ago

                                  I wasn't meaning to imply that XML is only for backend to frontend communication. I only mentioned they as it seems to be the most common task in web jobs today and is usually what a person does most often when I hear the complaint that XML is pointless and we should just use JSON.

                              • greggman65 3 days ago

                                Agreed. I tried XSLT once. I made an XSLT for RSS. Coding in XSLT really sucked.

                                • _heimdall 3 days ago

                                  Were you using XSLT 1.0 for native browser support? If so, yeah its pretty damn frustrating both in the APIs and the lack of browser support for basic debugging.

                                  • vgr-land 3 days ago

                                    LLMs make it much easier. Then you get all the benefits with few of the frustrations

                                    • xyz_opinion 3 days ago

                                      !

                                  • hackrmn 3 days ago

                                    Current state of things is a mixed bag, in my opinion. XSLT wasn't perfect, and XML required a lot of repetition and neither got the amount of scrutiny both deserved to advance past their own inconvenience. But a lot of what we have today has just as many drawbacks, and that _despite_ WHATWG and Google hawking over it all. XML had namespaces, which alone were quite a potent feature that allowed to manage _semantics_ of data with more rigor and flexibility -- compared to the in my opinion amateur-ish "custom elements" HTML 5 approach, and how Apple refuses to implement parts of the spec., because they "don't believe in inheritance" (I am being liberal but those who know know). Then there is the HTML 5 parser itself -- "for the masses" -- with its idiotic and incomprehensible rules that are element specific, for which reason noone ever remembers these. Forgot a `</p>`? No problem, you can discover your omission after you've shipped! HTML 5 parser never aborts!

                                  • diegof79 3 days ago

                                    The article's example shows the main reason (besides having old libraries shipped with Java) why XSLT didn’t have a significant adoption: UX/DX.

                                    The JSON transformation example is quite simple, and you can accomplish it with one or two lines of JS. But the XLST is unreadable, starting with tons of namespace imports.

                                    The usual argument is that a good UI can fix that, but that’s false. So using XSLT for general data transforms is very problematic: it's hard to read, with no debugging tools, and it’s also hard to build a UI tool that simplifies that for the “citizen integrator” (the segment of people who have technical knowledge and take care of doing integrations but are not experienced with programming).

                                    (Around 2017, I worked for a company that created its own data transformation tool, so I designed the UI editor and did user research of people using transformation languages in different scenarios.)

                                    • _heimdall 3 days ago

                                      > The article's example shows the main reason (besides having old libraries shipped with Java) why XSLT didn’t have a significant adoption: UX/DX

                                      I wonder if react would be popular today if it started out with the UX/DX we have today. It started out as a comparatively simple component-based library for rendering templates in the browser. It got popular and built a huge community before becoming the complete DX mess that it is today.

                                      • calmbonsai 3 days ago

                                        I lived and breathed XSLT back in the day for 3 projects over 2 years. Hell, I was the company's "XML evangelist" and spoke at XMLConf in San Diego.

                                        I would never go back.

                                        XSLT's "coding UX" is atrocious. Simple things "look complex" and complex things "look obfuscated".

                                        As mentioned in the parent post, there's also this consistent "low leverage" to the code so you feel as if you're typing a lot for little impact.

                                      • therealmarv 3 days ago

                                        If somebody wants to help XSLT 3.0...

                                        This open source Rust implementation needs more help of integrating the full XSLT 3.0 standard into their engine

                                        https://github.com/Paligo/xee

                                        • anonnon 3 days ago

                                          So does every other open source XSLT implementation, along with XPath/XQuery 3x. Most of them at best support 2x or 1x with some 2x-compatible extensions, but I'm not aware of any that fully support the 3x variants, besides Xidel (XPath/XQuery 3.0). The proprietary Saxonica is the go-to at the moment.

                                        • poshmosh 3 days ago

                                          I worked in the music streaming industry, which involves ingesting 10's of millions of XML files. Absolutely do not use XSLT. Schema changes between different versions of DDEX were a nightmare for all the legacy XSLT we had.

                                          • oever 3 days ago

                                            XSLT and XQuery 3.0 can have type annotations and implementations can even type check based on a XSD schema. That should help with adapting to version changes in input and output formats.

                                            • satyrnein 3 days ago

                                              I'm on the distributor side, I used to fantasize about using XSLT to produce all the different XML formats (beyond DDEX, like Apple, etc) from one house format, but that was probably a bad idea!

                                            • Devasta 3 days ago

                                              XSLT rocks. I have a team who come from business analyst and accounting backgrounds, we manage hundreds of reports for client data to their banks and could never manage it without something simple like XSLT to deal with it all.

                                              You give the employee IntelliJ or some IDE of your choice and a way of uploading the transforms into your application and they'll work away. All the complaints about namespaces and the like that your hear online? Never hear from them, they dont think about it, just stick the declarations up in the top of the file and work away.

                                              Abandoning XML has been one of softwares biggest mistakes.

                                              • zzo38computer 3 days ago

                                                The ability to use XSLT to convert JSON to HTML may be useful when making extensions for working with web sites that internally use JSON. Converting XML to JSON might also be useful for some things.

                                                However, XSLT would be useful with command-line programs too, and not only in a web browser, anyways. (A standalone implementation might also be made to have the ability to load extensions written in C.)

                                                There are problems with XML and with JSON, as well as with XSLT, but when dealing with XML and JSON formats anyways, XSLT can be helpful. (One problem is that XML does not deal very well with types other than Unicode text (JSON has a few additional types but still not very good). XSLT does add some types, though.)

                                                They also mention RDF, but the standard XML format for RDF is not very good in my opinion (although I think someone did make up a better XML format for RDF, for the help of being used with XSLT better).