Code Features

Nice things about Ftrain that you may never have noticed before.

Nice things about Ftrain that you may never have noticed before.

The Ftrain code, mostly by accident, has these exciting features:

  1. Allows for the creation of highly structured, linked narratives in fairly simple XML. Writing text for Web publication is easy for those who know HTML and the basic rules of XML.
  2. Organizes these narratives chronologically, automatically producing “most recent” views, as well as organizing things into larger, structured, multi-level narratives.
  3. Creates a pretty calendar.
  4. Has an, uh, integrated linking system that works nicely with your browser. If you see something you like, you click a button and a Javascript bookmarklet puts the right variables into a form; you then add a category and a description and it logs the link to an XML file. XSLT then sorts links by category and chronology, etc.
  5. Entirely written in vanilla XSLT sans extensions - the link CGI, and one command-line function that generates random numbers both require a little perl, but other than that it's clean as a whistle. It runs fine with SAXON and LibXSLT. XSLT is a fairly simple language and I've programmed everything by the book, using a functional rather than imperative style whenever possible (although I could do better). Nothing would stop it from running on Windows (it was developed on Linux).
  6. Produces totally vanilla HTML - nothing need be done on the server, although if you wanted to spit out PHP code from the XSLT for comment systems, or link things back to style sheets and the like, nothing is stopping you. If you run the XSL processor locally and then use rsync to copy the files, even with few hundred files you can usually upload all your changes in about a minute.
  7. On a 400 Mhz processor it takes 44 seconds to completely process 2.5 megs of nested XML, producing 725 or so linked files. Without the links, calendar, and random functions this is about 10-14 seconds. Thus you could churn the thing every ten minutes or hour with no harm done.