Tuesday, December 29, 2009

XML + XSLT --> HTML

I was (am) putting together a FAQ for my classmates. As I started writing it my first pick of format was synamtically valid HTML. I picked definition lists for the question list. My problem was that I needed to repeat certain information constantly. The "back to top" link, the "see also" link format, and a few other things.

After looking around I decided to write my FAQ in XML and write a simple python program to convert it to HTML. When I converted my entire FAQ to XML (a pain in of itself) I wrote a python program to convert it. I realized though that making a simple change to my XML spec (for example adding a "section" part) would require a reworking of my entire python script.

"Even more research" later I found XSLT. When I read the description (converting from XML to another format) I realized that it is exactly what I need. Anyway my FAQ is now written in a reason format (XML with a tag for each section, item, question, and answer) and is converted to HTML using a simple XSLT file.

I'll try post more about how I got some of the cooler features working soon.

No comments:

Post a Comment

Have something you want to say? You think I'm wrong? Found something I said useful?
Leave a comment!