Posted 2002-07-14T14:35:00+01:00 in recipe web
Okay, so my website doesn't look like much. But I've had it up and running for almost eight years now. Over time HTML changed quite a bit, and I keep experimenting with new browser technology. Some documents have been on my website since 1995 though. They've seen many layouts come and go.
Each time I want to change the layout of the page, I don't want to create a new HTML page and copy-paste the content into that page. No, instead I use a source webpage and translate that page in the final webpage with the right layout. Here's my setup:
xsltproc included with this library to take an XSL
and XML document and transform the XML in to another XML document.
To generate all the final HTML pages in one go, I use GNU make. I wrote a Makefile with a static pattern rule to create .html files from .xml files. As you can guess, all filenames of my content files end in .xml. This webpage for example has a source file named computing.xml.
Make checks to see if there is a final webpage, e.g. computing.html. If so, it compares the timestamps of both prerequisite content document and target final webpage to see if the final webpage is up-to-date with the prerequisite content document, e.g. computing.xml. If there is no target webpage, or the webpage is out-of-sync with the content document, make will run the XSL transformation:
pages = $(patsubst %.xml,%.html,$(wildcard *.xml))
all: $(pages)
$(pages): %.html: %.xml webpage.xsl
xsltproc --output $@ webpage.xsl $< A simple `make all` in the Bash shell generates all my webpages.
Note that you have to put a tab, not spaces, in front of xsltproc! And also notice that
webpage.xsl is a prerequisite, which means that if I edit the XSL, all pages will be regenerated.
As an advanced form of file backup I use version management on all my website files. I've been running Subversion (SVN) for half a year now and I'm quite content with it:
Oh, if you didn't understand by now, this is all command line stuff. I use the cygwin environment on Windows, so that I can use the same tools I would use on Linux.
February 18, 2007: Updated the link to the XSL. The document is not up to date with my current proces for editing the website, but the concepts are still valid: I'm still using XSLT and Makefiles.
April 28, 2004: I finally moved my homepage to a Debian box. I also started doing the XSLT transformation with a python script that drives libxslt.
2003: Wrote down this setup.
2002: Started using libxslt and subversion.