▲ | scotty79 a day ago | |||||||
XSLT is much nicer to use if you just create a very simple templating language that compiles to XSLT. Subset of XLST already has a structure of typical templating language. It can even be done with regexps. Then simplicity becomes a feature. You can write your page in pretty much pure HTML, or even pure HTML if you use comments or custom tags for block markers. Each template is simple and straightforward to write and read. And while different date format seems to be a one off thing you'd prefer to deal with as late as possible in the stack, if you think broader, like addressing global audience in their respective languages and cultures, you want to support that on the server so the data (dates, numbers, labels) lands on the client in the correct language and culture. Then doing just dates and perhaps numbers in the browser is just inconsistent. If browsers implemented https://en.m.wikipedia.org/wiki/Efficient_XML_Interchange the web would get double digit percent lighter and faster and more accessible to humans and ai. But that would let you filter out ads orders of magnitude easier. So it won't happen. | ||||||||
▲ | vidarh a day ago | parent [-] | |||||||
> You can write your page in pretty much pure HTML, or even pure HTML if you use comments or custom tags for block markers. That's exactly what we didn't want. The XSL encoded the view. The "page" was a pure semantic representation of the data in XML that wherever possible were direct projections from the models stored and serialied internally in our system, and the XSL generated each of the different views - be it HTML, RSS, Atom, or a condensed/simplified XML view. The latter was necessary largely because the "raw" XML data was more verbose than needed due to the deficiencies of XSL. It's possible it'd be more pleasant to use XSL your way, but that way wouldn't have solved any issues we had a need to solve. > you want to support that on the server so the data (dates, numbers, labels) lands on the client in the correct language and culture. That would've meant the underlying XML would need to mix view and model considerations, which is exactly what we didn't want. Today I'd simply use a mix of server-side transformations, CSS, and web components to achieve the same thing rather than try to force XSL to work for something it's so painful to use for. | ||||||||
|