Making a Blog
For anyone who has a little bit of experience with ftp and html, it seems a little strange to pay money for a tool that manages a blog. Publishing html files to a web site seems so simple. After reading the Weblog Tool Roundup(the author is a different Joshua Allen, BTW), where the author makes a similar point, I decided to experiment. I decided to try patching together freely-available tools in a way that could publish a static html weblog. And since I work with XML, I decided to see if I could do it with XML-oriented tools, and no traditional procedural coding. I offer up my experiment as proof that maintaining a weblog isn’t as easy as it seems (or maybe I am more incompetent than I think). You should also be able to see by the end of this why I am sticking with Radio. (Note: all source code snippets in this articleare licensed under the Free Market License).
First thing I needed to do was figure out a way to store posts. The most reasonable thing I could find on google was BlogML, so I decided to use it. To get a good representative sample of blog postings, I wrote a quick XSLT transform to convert Radio’s XML files to BlogML:
xmlns:util=”http://www.netcrucible.com/util.xslt“
xmlns:exsl=”urn:schemas-microsoft-com:xslt”
xmlns:str=”http://exslt.org/strings“
exclude-result-prefixes=”str util exsl”
version=”1.0″>
To invoke the transform, I used GNU Make with a rule to invoke command-line XSL processor (in my case, the msxsl command-line tool, but any command-line XSLT processor would do). I used the following Makefile:
import: $(addsuffix .blogml, $(basename $(wildcard *.radio)))
%.blogml: %.radio
msxsl $? radio2blogml.xslt authorname=”Joshua Allen” authormail=allenjs@hotmail.com >$@
You’ll notice that my stylesheet uses some of the free XSLT library available at exslt.org. I cheated by setting the exsl: prefix to namespacefor the Microsoft processor, because MSXML already comes with msxsl:node-set(). The other thing to notice is that I made up my own little utility librarynamed util.xslt to help with string scrubbing and date conversions. The utility stylesheet is included here:
Leave a Reply