Free Programming E-Books
Free download ebooks on computer and programming | |||
Free Ebook "Building Oracle XML Applications " Sample Chapter
Building Oracle XML Applications
Download chapter
Free Chapter 7: Transforming XML with XSLT This rich and detailed look at the many Oracle tools that support XML development shows Java and PL/SQL developers how to combine the power of XML and XSLT with the speed, functionality, and reliability of the Oracle database. The nearly 800 pages of entertaining text, helpful and time-saving hints, and extensive examples can be put to use immediately to build custom XML applications. Includes a CD-ROM with JDeveloper 3.1, an integrated development environment for Java developers. Transforming XML with XSLTWe've used XSLT stylesheets in previous chapters to transform database-driven XML into HTML pages, XML datagrams of a particular vocabulary, SQL scripts, emails, and so on. If you're a developer trying to harness your database information to maximum advantage on the Web, you'll find that XSLT is the Swiss Army knife you want permanently attached to your belt. In a world where the exchange of structured information is core to your success, and where the ability to rapidly evolve and repurpose information is paramount, Oracle XML developers who fully understand how to exploit XSLT are way ahead of the pack. XSLT 1.0 is the W3C standard language for describing transformations between XML documents. It is closely aligned with the companion XPath 1.0 standard and works in concert with it. As we'll see in this chapter, XPath let's you say what to transform, and XSLT provides the complementary language describing how to carry out the transformation. An XSLT stylesheet describes a set of rules for transforming a source XML document into a result XML document. An XSLT processor is the software that carries out the transformation based on these rules. In the simple examples in previous chapters, we have seen three primary ways to use the Oracle XSLT processor. We've used the oraxsl command-line utility, the XSLT processor's programmatic API, and the <?xml-stylesheet?> instruction to associate a stylesheet with an XSQL page. In this chapter, we begin exploring the full power of the XSLT language to understand how best to use it in our applications. XSLT Processing MechanicsAn XSLT stylesheet describes a transformation that operates on the tree-structured infoset of a source XML document and produces a tree of nodes as its output. Consider a simple XML document like this: <!-- Emp.xml --> <ROWSET> <ROW num="1"> <EMPNO>7839</EMPNO> <ENAME>KING</ENAME> </ROW> <ROW num="2"> <EMPNO>7788</EMPNO> <ENAME>SCOTT</ENAME> </ROW> </ROWSET>
A transformation of this document operates on the document's corresponding node tree (shown in Figure 7-1). The tree of nodes for an XML document always starts with a root node that represents the document itself. Child nodes of the root can be the single document element node- | |||