3 ms·
> XSLT is still an excellent way to turn structured data into a page Is it, though? I would think its only real win over a template system based on a scripting
by mikepurvis 6y ago
> XSLT is still an excellent way to turn structured data into a page
Is it, though? I would think its only real win over a template system based on a scripting language is when the template author is untrusted. And that niche is now much better covered by Liquid: https://shopify.github.io/liquid/ https://shopify.github.io/liquid/
- baybal2 6y agoTell me of a single template language supported client-side without JS
- mikepurvis 6y agoMaybe I just lack imagination, but what are the applications for this? The only thing I can think of might be some static data repository of raw XML files, which are accessed using a server that can send an XSLT header but you want to avoid loading up with template processing. In the case of a webapp, you're running JavaScript anyway, so it doesn't really matter. Fun fact— very early Google Maps used XML for the ajax responses, and then switched to JSON for performance/simplicity reasons, since the result was being used in code anyway, not just rendered and displayed.
- baybal2 6y agoTraffic, and cache hit optimisation. By "hydrating" a transformed page you get the best of two worlds. Both small initial package to render a page, cache hits, and relatively small SPA package.
- sergeykish 6y agoXML API - robots exchange XML, converted to human form with a stylesheet, both on the fly and stored documents. From the description of fields to full blown application, think XSLX plugged Excel stylesheet. That's how desktop applications work, maybe we should ask why is it not the norm? Why each request downloads application intertwined with data? Why can't one save response as one saves desktop document? I am ok with JSON but I want a way to plug application supported by browser, XML is the only choice yet.
- tannhaeuser 6y agoArguably, the most characteristic feature of XSLT is that it uses XML for serializing code text itself. As such, one can expect most benefit from XSLT which uses lots of literal XML content embedded into XSLT. But that can be had with any general-purpose language having XML literals as well (such as JSX or old E4X). Other than that, XSLT still remains a competent markup processor, and XSLT 1.0 (but no later version) is indeed highly portable. Since DSSSL (precursor of XSLT) is based on Scheme, I've always wondered if some HNers will pick-up OpenJade as its reference implementation.
- baybal2 6y agoYou can compose multiple XML docs using XSL, the catch is XML is not rendering until the whole document is loaded in Chrome, the benefit on the other side is that XSL, and referenced XML docs are cacheable.