←back to thread

210 points Evidlo | 1 comments | | HN request time: 0s | source

(spoiler: its XSLT)

I've been working on a little demo for how to avoid copy-pasting header/footer boilerplate on a simple static webpage. My goal is to approximate the experience of Jekyll/Hugo but eliminate the need for a build step before publishing. This demo shows how to get basic templating features with XSL so you could write a blog post which looks like

  <?xml version="1.0"?>
  <?xml-stylesheet type="text/xsl" href="/template.xsl"?>
  <page>
      <title>My Article</title>
      <content>
          some content
          <ul>
              <li>hello</li>
              <li>hello</li>
          </ul>
      </content>
  </page>
Some properties which set this approach apart from other methods:

  - no build step (no need to setup Jekyll on the client or configure Github/Gitlab actions)
  - works on any webserver (e.g. as opposed to server-side includes, actions)
  - normal looking URLs (e.g. `example.com/foobar` as opposed to `example.com/#page=foobar`)
There's been some talk about removing XSLT support from the HTML spec [0], so I figured I would show this proof of concept while it still works.

[0]: https://news.ycombinator.com/item?id=44952185

See also: grug-brain XSLT https://news.ycombinator.com/item?id=44393817

Show context
RebeccaTheDev ◴[] No.44991822[source]
Three jobs ago I worked for a company that did e-learning systems for industrial clients. This was roughly 2004. One of the company owner's many ideas was a technical documentation system based on XML and XSLT. The "idea" being that technical writers or SMEs would rather write XML than, you know, use a word processor.

Unsurprisingly the idea did not take off, but I did find the XML/XSLT combination to be very interesting.

replies(2): >>44994123 #>>44994194 #
1. the_other ◴[] No.44994123[source]
Between 2000 and 2003 I worked for a company that produced corporate training materials (initially on CDROM, later as learning-management-system units). We had a system which allowed the content authors to write in structured Word files. VBA would create XML of the Word files, and XSLT would create the HTML. I mostly worked in the XSLT and JS/CSS layers, not on the XML generation layer. It was my first job out of uni and I found XSLT fascinating and slightly psychedelic.