11 September 2003
I had this plan. A beautiful plan. You see, I went through the stylesheet with a machete and hacked away all the dead XSL-FO-liage.
OK, there were still some problems: I was unsure how to package everything and style it, with so many boards on one page. Instead of using IDs for the cells, I had to use classes. And file sizes were high, because this was uncompressed and my sample had over 80 boards. These weren’t serious problems, though, so I was happy.
The second part of the plan concerned getting the PGN data from a source and turning it into the XML format the the stylesheet wanted. I’d found a source for the games: ChessGames.com.
To make this happen, I wrote a doohickey (to complement the thing and the whatsit). It uses some simple string functions and one regex to grab the data the stylesheet needs and spoon it into an XML template (I figured the DOM was basically pointless for this).
Lo, it works! But of course there’s a problem. The PGN from ChessGames.com seems to be less verbose than that supplied with the stylesheet. So at the start, the only piece that can move to, say, E4 is the white pawn in E2. In what I’m calling
‘compact’
notation (bear in mind I haven’t read the spec), E4 is all that’s needed. In the
‘verbose’
notation, that would be P e2-e4.
The question, then, is where does the code go? In the stylesheet, because it would make it more powerful? Or in the script, because it would probably be easier?
Whatever, I’m going to have to figure out how chess pieces move for the first time in this…project? (Yes, I know how they move, but I haven’t had to express it in code). On the plus side, once it’s done I can look at making the pieces move interactively.