So I'm off caffeine as of today. For now, that is. I'm taking a break for a few months. It's not so much a resolution as a temporary abnegation for the purpose of healing my joie de café. See, the problem with coffee is that it's a great drink. I've become accustomed to having a cup to start every day. So accustomed that I no longer notice what a nice thing it is to have in the morning.

Looking forward to San Francisco

So this year's Game Developer's Conference is going to be in San Francisco. I just got some of the promo material at work today and the same at home yesterday. California is calling me. This time of year it's always nice to think of.

Can't wait.

XML to SVG with XSLT part I

In pursuit of useful applications of SVG, I've become interested in using XSL transforms to turn data stored as XML into an SVG representation. I found a good starting article at A List Apart and it pointed to a great reference by Paul Grosso and Norman Walsh. These might be dated now, but I found them helpful starting points.

On to my example. We're going to need some data. I had a look at StatsCan and found a report on population by sex and age group. I would have liked to get some more complete raw data, but it appears to cost a few bucks, so I'll make do. I believe there are ways to scrape the data out of the table with just XSLT, but since this is a learning experience for me, I decided to skip that step by just pulling the numbers out by hand and creating an XML file with a text editor.
The results of my effort look a little like this:

<?xml version="1.0" encoding='UTF-8'?>
<agegroup>90 and over</agegroup>

The root node is called "populationbyageandsex" and each record (or row of data) is kept in a "recordbyagegroup". Between the open and close tags for "recordbyagegroup" are the fields for that record. Each field has a unique name and the content (between the open and close tags) of the element is the value of the field. The format is something I just made up for this example, XML is nice that way.

The next step was to write the XSL transformations that would understand the data well enough to create a chart in SVG.


I expect that a lot of what comes up in this blog will be a draft of a page for another site I'm working on. That means that when it shows up here it may not have enough polish to be ready for prime time. The upside of this is that what's lacking in quality should be made up for in quantity. Examples and pages that I consider for other sites will show up here in a raw and less tested form.

Here's hoping you find what you came for.

Syndicate content