Tuesday, December 15, 2009

CRITICAL SKILL 8.7 Learn Programmatic Access Using XSLT


Team Fly 


Page 296



CRITICAL SKILL 8.7
Learn Programmatic Access Using XSLT



Data encapsulated in XML can be used in a number of ways. One common means of manipulating it is through the use of Extensible Stylesheet Language Transformations (XSLT), which enable developers to define operations that must be performed on an XML document to produce a specific result. This ability to transform information on the fly makes it possible to use a single source for multiple outputs such as HTML, whether those outputs lead to different databases or to different browsers. XML documents have structure but no format.



Oracle XML DB uses the template rules and other formatting elements that appear within the XSLT style sheets. It includes an XSLT-based transformation engine to automatically transform XML-tagged documents into multiple display formats, store the transformed renditions generated by the XSLT style sheets, and deliver content in the appropriate formats to various devices.



The following example shows how transform() can apply XSLT to an XSL style sheet, PurchaseOrder.xsl, to transform the PurchaseOrder.xml document:




SQL> select value(t).transform(xmltype(getDocument('purchaseOrder.xsl')))
2 from xmltable t
3 where existsnode(value(t),
4 '/PurchaseOrder[Reference=''MALLIA-200203311200000000PST"]'
5 ) = 1;
VALUE(T).TRANSFORM(XMLTYPE(GETDOCUMENT('PURCHASEORDER.XSL')))
-------------------------------------------------------------------------
<html>
<head/>
<body bgcolor="#003333" text="#FFFFCC" link="#FFCC00" vlink="#66CC99" alink="#
669999">
<FONT FACE="Arial, Helvetica, sans-serif">
<center>
...
</FONT>
</body>
</html>


And now we are at the end of this chapter. Unfortunately, we have only been able to lightly understand some of the functionality implemented with Oracle XML DB. As XML grows in popularity within the information management community, so too will Oracle's attention to this data type. If there are any detractors out there who want to complain that perhaps Oracle Database 10g's journey into XML is too little too late—watch out. Even if there is any substance to complaints about Oracle's technology direction and implementations, it won't be long before they are setting the trend in new areas yet again.



Team Fly 

No comments: