PHP + XML + XSLT + OS X

Filed under

I'm going into the last day of a week long XML course at work. The class has been great, despite being completely Microsoft-centric. Despite this, the instructor has done a good job of covering the topics and inspiring many possible projects in my head. Most of these projects are for the day job and will focus mainly on XSL transformations of training manuals. So, my challenge was to get an XSL parser that works with PHP. A buddy at work informed me that I'd need Sablotron to do XSL with PHP.

There are other possible options but I decided to pursue the Sablotron option. My first attempts involved installing expat and other required libraries with Fink. This part went quite smoothly but I ran into problems when attempting to build Sablotron from source. I'm not quite sure what the problem was. Plan B involved getting the DarwinPorts client and using it to build the Sablotron package. This option went smoothly. DarwinPorts took care of installing all required libraries and then Sablotron. The installation instructions on the DarwinPorts site are straight forward and rather easy to follow.

  1. Install the Dawin Ports .dmg
  2. Configure DarwinPorts
  3. Install the Sablotron package
  4. Oh, you'll also want to install Marc Liyanage's PHP module.

If you're successful (or you need to check), see Benson Wong's article "Using PHP and XSL to Transform XML into Web Content". If you're looking for other options, you might want to consider installing PHP PEAR's XML_Transformer package and reading Bruno Pedro's article at xml.com.

Share