5 ms·
XSLT is actually insanely cool, it's just poorly executed. For example, XSLT lets you decouple the content structure of your document from the presentation str
by PeCaN 11y ago
XSLT is actually insanely cool, it's just poorly executed.
For example, XSLT lets you decouple the content structure of your document from the presentation structure. XSLT makes nested <div> obsolete. It lets you have responsive HTML—you can serve different stylesheets to differently sized browsers (or switch them on-the-fly with JS). In general, what it can do is cool, but using it is not. If XSLT weren't something of a trainwreck the web would be in a better place.
- voltagex_ 11y agoIt's also seriously useful in an email tempting system - look up this content, apply this XSLT, send the resulting HTML email.
- vbezhenar 11y agoXSLT is cool "theoretically". It was made to solve real problems with correct approach. But practical implementation is not cool at all. XML is not good as a programming language representation. As an alternative to XSLT consider CDuce language. It was made to solve a similar problem: XML manipulation. But language itself uses traditional syntax and much easier to use and understand.
- spdustin 11y agoXML is not meant to be a programming language representation. It's meant to be a predictable, simple set of grammatical rules for representing data that may be hierarchical/shaped/tree-like. XSLT is meant to provide a library of templates used to transform XML to something else (usually XML again, but can be nearly any output format) in a declarative way. XSL is a little bit like CSS in one way: CSS has selectors, and XSL does too. CSS also has rules (one or more selectors and the properties listed for them) that apply to an output device's representation of the nodes matching those selectors (e.g. a browser's visual styling), and XSL has templates that change the structure of the nodes that match the XSL template's selector. Each template has a context, can transform the input "tree" to any intermediate representation necessary, can apply itself recursively, and can completely transform the XML-structured input into practically any output required. It's also a religion along the same lines as vim/emacs/atom or Mac/PC/Linux/UNIX/BSD/etc., and thus, discussions decrying the blasphemy of declarative transformations will result in fervent cries of, "XSL sucks, nuke it from orbit," as well as equally impassioned speeches that, "XSL kicks ass, get enlightened!"
- Mikhail_Edoshin 11y agoIt's not that bad; besides, this allows to embed XSLT inside XML documents or transform XSLT using another XSLT. E.g. I remember having a large project I initially split into multiple XSLT files; in the end I wrote a XSLT to take them all and combine into a single file.
- Mikhail_Edoshin 11y agoI second that, except the bit that it's poorly executed. Especially v2.0, although even v1.0 is fine if you can add your own extensions. I wish v2.0 was not confined to Javaland. Maybe someday. How come Web has stuck with HTML and CSS is beyond my comprehension. It's like selling their firstborn right for a bowl of animations.