6 ms·
XSLT 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 d
by bibonix 12y ago
XSLT 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
- raverbashing 12y agoMy definition of powerful and elegant is lisp XML is just death by overengineering
- patrickg 12y agoapples 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.
- boomlinde 12y agoThe site in question lists several alternatives, some of which are widely in use especially in cases where XML falls short: brevity, fast to parse, easily readable... Most of all, calling it the de facto standard is either dishonest or clueless.
- patrickg 12y agoI am working for many years in the publishing business (dealing with structured documents, product data etc.). I can tell you, that all of my customers are more open XML than any other document formats (there exist none as suitable for the job). You can call me clueless or dishonest, I don't care. I can only share my experience with the topic. You don't have to believe me.
- boomlinde 12y agoYour customers in the field you work in, perhaps, but it's hard to tell that's what you mean when you write data exchange. It's a wide field that is not limited to the publishing business or your customers.
- ilitirit 12y ago> Most of all, calling it the de facto standard is either dishonest or clueless It is in fact the de facto standard in the publishing industry. The "other" format is of course PDF. Maybe all of this will change when we have more technologies that support formats that can handle mixed content as easily as XML.
- Mikhail_Edoshin 12y agoDoes anyone use Microsoft XPS? It looked rather interesting; like PDF without any interactivity (except for links) and with special support for publishing (color management, job tickets, etc.). And internally it is a collection of XML docs and binary data zipped together into a single file; pretty neat, must be easier to use in automated workflows.
- patrickg 12y agoI can't answer the question but anyway: None of my customers have ever asked for that. I have not seen a printing house that demands XPS. So I doubt that it plays any role in the market (Germany here).
- Mikhail_Edoshin 12y agoThanks, that's informative. I haven't seen it used much either; the only real use I saw (aside from viewing) was an XPS printer driver for a Canon inkjet printer. (I've also heard that it produced better results than the standard driver, but have no first-hand experience.)
- justincormack 12y agodatabases are not structured documents, you can export them eg in JSON perfectly well. Or for that matter in SQL as is the usual practise. Marked up structured text is a different matter, XML still has a use case there.
- patrickg 12y agoI was a bit unclear. When I get database dumps, I get them as Excel files or as an XML document. Most of the times the documents I get are hierarchically structured. Yes, JSON could be fine as well. But it simply lacks a standard toolchain which XSLT ans its ilk proides. I am not trying to defend XML in any way. I just want to say the two things: a) my customers never deal with JSON, but often with XML, so JSON (and other formats) are not an issue for me b) There is a very nice toolchain for XML, including formatters, tranformation tools, database publishing tools (my very own: https://speedata.github.io/publisher/index.html https://speedata.github.io/publisher/index.html) and many others. I have not found such a toolchain for other formats.
- justincormack 12y agoBut XML does not map well to a database dump. A database is a set of sets of tuples. It is not generically hierarchical. It maps to a set of csv files say, as a transfer medium, but it is designed to be manipulated through relational calculus, which is not easily mapped to xslt. You are using tools not because they map well to the problem space, but because they are the tools you have, which your customers want, and which you are familiar with, but that does not mean they are actually mapping well to the domain.
- patrickg 12y agoActually the XML part is the one that maps best to the problem space. I deal with structured documents (such as part/title/paragraph ... or product group/product/components). The database part (usually Excel sheets or SQL based stores) are the ones that are "insufficient".
- dragonwriter 12y ago> XML might be overengeneered (which, except for a few things I don't agree with), but there is currently no alternative for it. There's perhaps no general alternative to it that covers all of the things XML tries to do; there are lots of specific alternatives that cover specific things that XML tries to do. The complaint against XML isn't that there is a better general replacement so much that there is a better replacement for each (or at least, very many) of the applications and that trying to shoehorn all of them into a single solution has costs that outweigh the benefits.
- peteretep 12y ago> My definition of powerful and elegant is lisp Dude, XML is just s-exprs and XSLT is macros.
- raverbashing 12y agoREALLY? http://en.wikipedia.org/wiki/XSLT#Example_1_.28transforming_XML_to_XML.29 http://en.wikipedia.org/wiki/XSLT#Example_1_.28transforming_...
- VMG 12y agoI want to enter this piece of evidence into the trial: Comma separated string parsing XSLT: http://stackoverflow.com/a/2850181/92493 http://stackoverflow.com/a/2850181/92493
- arethuza 12y agoIf you are using XSLT to work on anything other than XML you are doing very strange things.
- raverbashing 12y agoOh good, so it's only good in the world of XML That's what I call USELESS
- deleted 12y ago[deleted]
- dasil003 12y agoXML and XSLT are analagous to s-exprs and macros, to say they are "just" those things is willful ignorance of a whole boatload of complexity.
- raverbashing 12y agoGood, so I'll replace the '<' in XML with '#:-D' and the '>' with '%:-/' Or replace indenting levels with the XPath of where it belongs and make order optional Syntax matters.
- radicalbyte 12y agoThe 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.
- crdoconnor 12y agoThe problem is not that it is misused. The problem is that there is a small subset of problems for which it works passably (like many other technologies) and a large universe of problems for which it will cause you massive pain.
- brunnsbe 12y agoUsing compiled XSLT-translets in Java (XSLTC) has a huge impact on performance, with transformations taking 0.5s the problem seems to be in the way your XSLT is written and pushing or pulling the data, not XSLT itself: http://xalan.apache.org/old/xalan-j/xsltc_usage.html http://xalan.apache.org/old/xalan-j/xsltc_usage.html
- Mikhail_Edoshin 12y agoCompiled XSLT stylesheets must be very efficient; they're automata, like regular expressions.
- donum 12y agoSince two years I am working full time on a website which gets rendered via XSLT (via Apache Cocoon). When I joined, it was kind of a mess and I had a hard time understanding XSLT and the templates written. Just recently I had the chance to do a rewrite. What I did is I created "my own HTML". Basically every module of Twitter Bootstrap has it's own XSLT template. That means you have a very easy XML "HTML" syntax, but the output is Twitter Bootstrap. And every piece of output HTML is defined just once in the whole application so it's easy to maintain. With the help of XSLT you can abstract a lot of things. One example: I have an element called <colgroup/>. It can contain up to 12 <col/> elements. if I set the @size attribute to one of the columns, the @size attribute for the others will be calculated automatically and the output matches the Twitter Bootstrap CSS classes. I have to say, I love it. I can't imaging writing the whole mess of Twitter Bootstrap plain HTML in a template anymore.