Team LiB
Previous Section Next Section

Chapter 9. XSLT and Other XML Concerns


Extensible Markup Language (XML) is one of the most intriguing new standards to emerge in the world of information technology in the past ten years. XML defines a simple standards-oriented, plain-text structure for exchanging and storing data consistently and accurately, at times between very dissimilar hosts and when using nearly any transmission method or storage medium. Extensible Stylesheet Language (XSL), a subset of XML, is used to transform XML documents of one type into documents of another type while preserving relevant data.

This chapter presents enough introductory information about Extensible Stylesheet Language, its subset XSL Transformations (XSLT), and about PHP's comprehensive set of XML-related features, to help you to accomplish a number of XML-related information processing tasks using PHP. Specifically, in this chapter you will find details and examples showing how to

  • Use the XSL Transformations (XSLT) to accurately describe transformations from well-formatted XML documents into well-formatted and consistent HTML or XHTML code, suitable for rendering in a standards-compliant Web browser.

  • Use the DOM XML or XSLT modules to apply XSLT stylesheets to XML files when using PHP4, or use DOM and XSL module features to apply XSLT stylesheets to XML files when using PHP5.

  • Use SimpleXML for quick-and-dirty access to data in XML documents in PHP5, rather than having to parse them using the more complex methods.

  • Output the XML data from objects you're using in your PHP scripts and store the data to a text-based XML file.

Because space is limited and XSLT is a potentially complex topic, the XSLT details in this chapter will focus entirely on simple examples involving transformations from XML into HTML or XHTML for general World Wide Web use. More detailed information on XSLT files can be found in the World Wide Web Consortium's standards document for XSLT called "XSL Transformations (XSLT)," which can be found at

Additional details on using XSLT with PHP can also be found in the official documentation for PHP, available at

    Team LiB
    Previous Section Next Section