3 ms·
This is a very old way of building websites. I have not heard of this being done in a very long time. The problem was maintainability of the XSLT sheets. And al
by TedDoesntTalk 4y ago
This is a very old way of building websites. I have not heard of this being done in a very long time. The problem was maintainability of the XSLT sheets. And although you say no server-side processing is needed, the XML was almost always generated server-side from underlying database queries. That’s the only way to make the pages dynamic.
- rsolva 4y agoYeah, it seems like it went out of use between 2010-16, altough XSLT v3 was "released" in 2017. My main interest is to find out if XML/XSLT can be used to write reusable components, like a header and footer, that can be easily included on every page on a static site.
- moistly 4y agoYes, easily.
- rsolva 4y agoThen the question becomes; how? From what I can see, the standard way is to push data, no pull. Data is stored in the XML-file and a stylesheet is called upon to manipulate that data. What if I wanted to make a classic blog structure with posts in a /content folder, fetch (pull) the title and description from each post and display it on the front page?
- moistly 4y agoYou fetch XML, JSON, or structured plaintext documents from the content folder, use XPath (XML or JSON) or use string processing (plaintext) to retrieve the appropriate fields, and transform the data to HTML. Short of writing your application for you, I don’t see how you expect an answer other than “it can be done.” You need to learn how to use the toolset, as with any other language.
- TedDoesntTalk 4y agoOne key point is that the XML do not need to be stored as files on the server. They can be generated at request time by turning database queries into XML responses using your favorite server-side language. The XSLT can be hosted as static files on the webserver.
- moistly 4y agoI’ve personally used AsciidoctorJS + SaxonJS to render pages. I keep intending to see what I can do with the HN API and XPath/XSLT.
- TedDoesntTalk 4y agoWhy would you bother doing that in 2022? It doesn’t really seem relevant anymore.
- moistly 4y agoWhy on earth wouldn’t I? I wanted to experiment, learn a few things, have a bit of fun. Not everything needs to be super serious.
- TedDoesntTalk 4y agoI did not realize you’re doing it for experimentation. I thought some kind of live product.