I have a long document in XML from which I need to produce static HTML pages (for distribution via CD). I know (to varying degrees) JavaScript, PHP and Python. The current options I’ve considered are listed here:
-
I’m not ruling out JavaScript, so one option would be to use ajax to dynamically load the XML content into HTML pages. Edit: I’d use jQuery for this option.
-
Learn some basic XSLT and produce HTML to the correct spec this way.
-
Produce the site with PHP (for example) and then generate a static site.
-
Write a script (in Python for example) to convert the XML into HTML. This is similar to the XSLT option but without having to learn XSLT.
Useful information:
-
The XML will likely change at some point, so I’d like to be able to easily regenerate the site.
-
I’ll have to produce some kind of menu for jumping around the document (so I’ll need to produce some kind of index of the content).
I’d like to know if anyone has any better ideas that I haven’t thought of. If not, I’d like you to tell me which of my options seems the most sensible. I think I know what I’m going to do, but I’d like a second opinion. Thanks.
I think XSLT is by far the easiest and best method — even taking into account having to learn xslt.
There are several styles of xslt programming, but the easiest is “push processing” , where you write several templates that describe how your xml input is to be transformed into html output. Then you write a root template that outputs the basic html wrapper and calls the other templates. The root
template is the easy one: