3 ms·
XSLT 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 pr
by vbezhenar 11y ago
XSLT 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.