Tutorials
PHP OracleNow that you have the employees XSL stylesheet stored in the database and the xmlusr schema is permitted to access the hr.employees table, you can create a script that will instruct the database to build an HTML page based on the data stored in hr.employees.
The following listing contains the source code for such a script.
As you can see, the select list of the SELECT statement used in the DBServerXSLTrans.php script includes the XMLtransform SQL/XML function. This function is used here to apply the employees XSL stylesheet retrieved from the XSLTstylesheets table by the subquery to the employees XML document generated by the subquery defined in the FROM clause of the query. The result of this transformation should be an HTML page, which you load into a new DOMDocument object and then display it in the browser. When displayed, the generated HTML page should look like the figure shown in the Transforming and Processing XML with XSLT section shown earlier in this chapter.
The preceding example shows how you might move the XML processing performed by your PHP/Oracle application from PHP to Oracle, thus taking advantage of the optimizations provided by the Oracle database server. In particular, you saw how to generate an XML document from scratch and apply an XSL transformation inside the database, rather than performing these operations with PHP.
In fact, Oracle XML Database provides much more functionality than what the sample demonstrates.
NOTE: Oracle XML DB refers to the set of Oracle Database XML technologies integrated with the relational database server, providing high performance XML storage, retrieval, and processing.
The most significant features of Oracle XML DB, which make Oracle database ideal for XML-enabled database-driven applications, are listed below:
The subsections that follow show how you can make use of these features when building XML-enabled PHP/Oracle applications.