Using Named Buffers

Thus far, all the examples you’ve seen have assumed the XML and XSLT data to be stored in static files. This assumption is true in most cases; however, some occasions do arise when your XML is dynamically generated, either from a database, by combining two or more files, or from some other dynamic data source. In such cases, saving this dynamically generated XML to a file and then processing it with xslt_process() can be a needlessly long and tedious process.

This is where named buffers come in. Named buffers allow you to store your XML and XSLT data in memory and then pass these variables on to xslt_process() for normal XSLT transformation.

As discussed in the “A Closer Look at xslt_process()” sidebar, the xslt_process() ...

Get XML and PHP 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.