Chapter 4. PHP and Extensible Stylesheet Language Transformations (XSLT)
"Out of intense complexities, intense simplicities emerge."Winston Churchill
Data marked up in XML can be put to a variety of different uses. It can be tagged for identification by search engines, transmitted from one location to another, or formatted for rendering in a web browser or other display agent. The preceding chapters have focused primarily on this last application, using DOM and SAX to process and format XML data for simple user-friendly display.For mere information formatting and display, using the DOM or SAX approach is a snap. The process is simple and, once you've figured out how it works, adapting it to your particular requirements is a piece of cake. When it comes to longer, more complex transformations, though, using either of these two approaches can be a lot like using a water pistol to put out a forest firetedious and, in the long run, not very efficient. For these complex conversions, it's far more effective to use XSL Transformations (XSLT), a stylesheet language designed expressly for the purpose of converting, or "transforming," XML documents into other formats (XML, HTML, WML, ASCII, and so on).This chapter examines PHP's XSLT extension, reprising examples from earlier chapters to demonstrate how XSLT can be used to quickly and easily create and format different types of documents from a single XML source.