concept XSLT in category php

This is an excerpt from Manning's book PHP in Action: Objects, Design, Agility.
The existing application had flexibility built in so that a web designer could change the layout templates to create a completely new layout. Everything was based on CSS and XSLT, so all it should take, in theory at least, was to copy all the style sheets and modify them. Unfortunately, that was not what was needed for this particular new customer. The task required tweaking existing features, removing some, and squeezing it into the layout that had been specified. Partly because of the size of the application, and the fact that the new required layout was simpler, it was easier to discard the old templates and use the HTML file as a starting point for new templates. So as far as the new requirements were concerned, the work that had been put into making it flexible was mostly wasted.
XSLT stylesheets are another popular way of expressing the HTML tag content of a web page. XSLT, the XML stylesheet language, is a way of transforming XML documents into HTML documents or into other XML documents. So if we want to use XSLT as templates in a PHP application, we first generate XML code, transform that using XSLT, and output it to the browser. Figure 13.5 shows how XSLT works when generating web pages. The stylesheet can be similar to the templates we’ve seen before, but is officially a recipe for the transformation of the XML file into HTML.
XSLT is very different from the other template systems. It’s a powerful, non-procedural programming language. You can do all sorts of advanced things with it. But it’s not necessarily the answer to all your template prayers. Its main advantage is its status as a cross-platform standard. Martin Fowler says:
When setting up a PHP application based on XSLT, we can start by making the transformation work independently of PHP. To do that, we need