Skip Headers

Oracle9i XML Developer's Kits Guide - XDK
Release 2 (9.2)

Part Number A96621-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to next page

21
XSLT Processor for PL/SQL

This chapter contains the following sections:

Using the XML Parser for PL/SQL: XSLT Processor (DOM Interface)

Extensible Stylesheet Language Transformation, abbreviated XSLT (or XSL-T), describes rules for transforming a source tree into a result tree. A transformation expressed in XSLT is called a stylesheet.

The transformation specified is achieved by associating patterns with templates defined in the stylesheet. A template is instantiated to create part of the result tree.

This PLSQL implementation of the XSL processor follows the W3C XSLT working draft (rev WD-xslt-19990813) and includes the required behavior of an XSL processor in terms of how it must read XSLT stylesheets and the transformations it must effect.

The types and methods described in this document are made available by the PLSQL package, xslprocessor().

Figure 21-1 shows the XML Parser for PL/SQL XSLT Processor main functionality.

  1. The Process Stylesheet process receives input from the XML document and the selected Stylesheet, which may or may not be indicated in the XML document. Both the stylesheet and XML document can be the following types:
    • File name
    • Varchar buffer
    • CLOB

    The XML document can be input 1 through n times.

  2. The parsed XML document inputs XSLProcessor.processXSL(xslstylesheet,xml instance) procedure, where:
    • XML document is indicated in the "xml instance" argument
    • Stylesheet input is indicated in the "xslstylesheet" argument
  3. Build the stylesheet using the Stylesheet input to the XSLStylesheet() procedure. The following methods are available for this procedure:
    • removeParam()
    • resetParam()
    • setParam()

    This produces a stylesheet object which then inputs the "Process Stylesheet" step using procedure, XSLProcessor.processXSL(xslstylesheet,xml instance).

  4. The "Process stylesheet" process can be repeated 1 through n times. In other words, the same stylesheet can be applied to multiple parsed XML documents to transform them wither into an XML document, HTML document, or other text based format.
  5. The resulting parsed and transformed document is output either as a stream or a DOM document.
  6. When the XSLT process if complete, call the freeProcessor() procedure to free up any temporary structures and the XSLProcessor procedures used in the XSL transformation process.

Figure 21-1 "XML Parser for PL/SQL: XSLT processor (DOM Interface)

Text description of adxml058.gif follows
Text description of the illustration adxml058.gif


XML Parser for PL/SQL: XSLT Processor -- Default Behavior

The following is the default behavior for the XML Parser for PL/SQL XSLT Processor:

XML Parser for PL/SQL Example: XSL -- iden.xsl

This XSL file inputs the xslsample.sql.

<?xml version="1.0"?> 

<!-- Identity transformation -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:template match="*|@*|comment()|processing-instruction()|text()">
  <xsl:copy>
  <xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()"/>
  </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

Go to previous page Go to next page
Oracle
Copyright © 2001, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback