Serving XML in Any Format

We see something interesting in the Oracle XSQL Pages material explaining that we can create a new XSQL page that reuses the dynamic XML content produced by another page with a tag called <xsql:include-xsql> . We also notice that by including one extra line at the top of our page, like this:

<?xml-stylesheet type="text/xsl" href="FAQ-In-XML.xsl"?>

we can get the XSQL page processor to handle the XSLT transformation automatically before it returns the results to the requester. So we combine these two little pearls of information to create a new XSQL page called FAQXML.xsql:

<?xml version="1.0"?>
<!-- FAQXML.xsql: Show FAQ.xsql in Standard FAQ-List.dtd Vocabulary  -->
<?xml-stylesheet type="text/xsl" href="FAQ-In-XML.xsl"?>
<xsql:include-xsql href="FAQ.xsql" xmlns:xsql="urn:oracle-xsql"/>

This uses <xsql:include-xsql> to include the XML results from our previous work, and associates the FAQ-In-XML.xsl stylesheet we created above to this page. Now, when we try from our browser to request the new XSQL page for the jdev category of frequently asked questions, as shown in Figure 3.2, we see our dynamic information in our <FAQ-List> format with no manual steps involved. Pretty neat.

Viewing the dynamic FAQ in the FAQ-List XML format

Figure 3-2. Viewing the dynamic FAQ in the FAQ-List XML format

Just then, we learn that our CEO is expanding into Europe by acquiring another promising startup in London. In a parallel universe, ...

Get Building Oracle XML Applications 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.