From: "andrew cooke" <andrew@...>
Date: Mon, 10 Mar 2008 07:18:08 -0400 (CLT)
Over the weekend I made a new (sub-)site for my photos - http://www.acooke.org/photography/ I generated the site using a similar approach to the Pancito site, but instead of using Halipeto (the Haskell based templating system that uses XML as a database) I used XSLT with a Python script. There are two XML files - one describes the structure of the site and the other describes each photograph. There are also two XSLT files - one for the front page and that is re-used for each photograph. The Python script looks after directory deletion/creation, copying of photos, and the calling of the two XSLTs. The site is completely static (from the server's POV) - each image has a different page. The front page randomly loads an image via Javascript on the client. The trickiest part was getting the previous/next links working from XSLT. The XSLT for a photo is invoked on the photo description XML, so it needs to explicitly load the site description XML to find the neighbouring photographs. However, that turned out to be quite simple in practice: <xsl:variable name="site" select="document('../xml/site.xml')"/> <xsl:variable name="previous" select="$site//site:image[@id=$image]/preceding-sibling::*[position()=1]"/> where $image is the ID of the current photo (passed from Python). Andrew