My PHP application will need to be able to export to (and import from) a range of different data formats, mostly XML based.
I have the option of
- In PHP, use DOM to export to some XML based format that is a superset of all the data needed by the others, and create a separate XSLT stylesheet for each output format I want to support, running the DOM output through PHP's XSL extension.
or
- Not using PHP's XSL extension, but implementing each output format as a class in native PHP that translates directly from the internal objects/structures to a given XML format using DOM, each such class implementing the same interface so they are interchangeable.
The app will be used by universities and is a tool that manages 'people' records in various ways, and imports/exports from various sources like their HR system, etc. I'll be implementing the set of input and output formats myself, but in future there is the chance that someone using it will want to modify it to support their own format.
One reason I'm considering NOT using XSLT is that if anybody else is going to maintain the app in future other than me, it seems that very few people even know XSLT - a lot more people seem to know PHP.
Another is that the second seems like a more efficient and 'programmery' solution, and more flexible in the sense that I'd be able to output to and import from non-XML formats like CSV or column based text just as easily by overloading the necessary parts of the class, not that that would often be necessary.
A third, but very small and insignificant reason is that PHP needs recompiling to enable XSL whereas DOM is enabled by default, so it would be a tiny bit more portable. However this isn't too much of a problem as it's easy to reconfigure PHP.
What do you think of my reasoning?