Transformations

One of XML’s great advantages is that you can easily manipulate an XML document into another format. It could be HTML, PDF, or even another XML document. For instance, you could create an RSS feed for the articles in your XML-based CMS.

XSLT, short for Extensible Stylesheet Language Transformations, is a W3C-defined language for modifying XML documents. With XSLT, you can create templates (written, of course, in XML) that act as a series of instructions for how an XML document provided as input should end up as output.

If you’re unfamiliar with XSLT, check out XSLT, by Doug Tidwell, or Sal Mangano’s XSLT Cookbook (both published by O’Reilly). XSLT assumes no knowledge of XSLT, while XSLT Cookbook is more useful for programmers who want a grab bag of recipes to solve commonly encountered XSLT tasks, such as renaming attributes and elements. The complete specification is located at http://www.w3.org/TR/xslt.

Get Upgrading to PHP 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.