The DBMS_XSLPROCESSOR package provides an interface to manage the contents and structure of XML documents.
This chapter contains the following topics:
Overview
Security Model
Summary of DBMS_XSLPROCESSOR Subprograms
See Also:
This section contains topics which relate to using the DBMS_XSLPROCESSOR
package.
The DBMS_XSLPROCESSOR
package provides an interface to manage the contents and structure of XML documents.
This PL/SQL 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 transformation it must effect.
The Extensible Stylesheet Language Transformation (XSLT) 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.
The following is the default behavior for this PL/SQL XSL Processor:
A result tree which can be accessed by DOM programmatic interface
Errors are not recorded unless an error log is specified; however, an application error will be raised if parsing fails
Table 181-1 DBMS_XSLPROCESSOR Package Subprograms
Method | Description |
---|---|
Writes content of a |
|
Frees a processor object |
|
Frees a stylesheet object |
|
Returns a new processor instance |
|
Creates a new stylesheet from input and reference URLs |
|
Transforms an input XML document |
|
Reads content of the file into a |
|
Removes a top-level stylesheet parameter |
|
Resets the top-level stylesheet parameters |
|
Selects nodes from a DOM tree that match a pattern |
|
Selects the first node from the tree that matches a pattern |
|
Sets errors to be sent to the specified file |
|
Sets a top-level parameter in the stylesheet |
|
Turns warnings on or off |
|
Transforms a node in a DOM tree using a stylesheet |
|
Gets the value of the first node that matches a pattern |
This procedure writes content of a CLOB
into a file.
DBMS_XSLPROCESSOR.CLOB2FILE( cl IN CLOB; flocation IN VARCHAR2, fname IN VARCHAR2, csid IN NUMBER:=0);
This function returns a new Processor
instance. The function must be called before the default behavior of Processor
can be changed and if other processor methods need to be used.
This function creates and returns a new Stylesheet
instance. The options are described in the following table.
Creates and returns a new stylesheet instance using the given DOMDOCUMENT
and reference URLs:
DBMS_XSLPROCESSOR.NEWSTYLESHEET( xmldoc IN DOMDOCUMENT, ref IN VARCHAR2) RETURN Stylesheet;
Creates and returns a new Stylesheet
instance using the given input and reference URLs:
DBMS_XSLPROCESSOR.NEWSTYLESHEET( inp IN VARCHAR2, ref IN VARCHAR2) RETURN Stylesheet;
This function transforms input XMLDocument
. Any changes to the default processor behavior should be effected before calling this procedure. An application error is raised if processing fails.
Transforms input XMLDocument
using given DOMDocument
and stylesheet, and returns the resultant document fragment:
DBMS_XSLPROCESSOR.PROCESSXSL( p IN Processor, ss IN Stylesheet, xmldoc IN DOMDOCUMENT), RETURN DOMDOCUMENTFRAGMENT;
Transforms input XMLDocument
using given document as URL and the Stylesheet
, and returns the resultant document fragment:
DBMS_XSLPROCESSOR.PROCESSXSL( p IN Processor, ss IN Stylesheet, url IN VARCHAR2, RETURN DOMDOCUMENTFRAGMENT;
Transforms input XMLDocument
using given document as CLOB
and the Stylesheet
, and returns the resultant document fragment:
DBMS_XSLPROCESSOR.PROCESSXSL( p IN Processor, ss IN Stylesheet, clb IN CLOB) RETURN DOMDOCUMENTFRAGMENT;
Transforms input XMLDocument
using given DOMDOCUMENT
and the stylesheet, and writes the output to the specified file:
DBMS_XSLPROCESSOR.DBMS_XSLPROCESSOR.( p IN Processor, ss IN Stylesheet, xmldoc IN DOMDOCUMENT, dir IN VARCHAR2, fileName IN VARCHAR2);
Transforms input XMLDocument
using given URL and the stylesheet, and writes the output to the specified file in a specified directory:
DBMS_XSLPROCESSOR.PROCESSXSL( p IN Processor, ss IN Stylesheet, url IN VARCHAR2, dir IN VARCHAR2, fileName IN VARCHAR2);
Transforms input XMLDocument
using given DOMDOCUMENT
and the stylesheet, and writes the output to a CLOB
:
DBMS_XSLPROCESSOR.PROCESSXSL( p IN Processor, ss IN Stylesheet, xmldoc IN DOMDOCUMENT, cl IN OUT CLOB);
Transforms input XMLDocument
using given DOMDOCUMENTFRAGMENT
and the stylesheet, and returns the resultant document fragment:
DBMS_XSLPROCESSOR.PROCESSXSL( p IN Processor, ss IN Stylesheet, xmldf IN DOMDOCUMENTFRAGMENT) RETURN DOMDOCUMENTFRAGMENT;
Transforms input XMLDocumentFragment
using given DOMDocumentFragment
and the stylesheet, and writes the output to the specified file in a specified directory:
DBMS_XSLPROCESSOR.PROCESSXSL( p IN Processor, ss IN Stylesheet, xmldf IN DOMDOCUMENTFRAGMENT, dir IN VARCHAR2, filename IN VARCHAR2);
Transforms input XMLDocumentFragment
using given DOMDOCUMENTFRAGMENT
and the stylesheet, and writes the output to a buffer:
DBMS_XSLPROCESSOR.PROCESSXSL( p IN Processor, ss IN Stylesheet, xmldf IN DOMDOCUMENTFRAGMENT, buf IN OUT VARCHAR2);
Transforms input XMLDocumentFragment
using given DOMDOCUMENTFRAGMENT
and the stylesheet, and writes the output to a CLOB
:
DBMS_XSLPROCESSOR.PROCESSXSL( p IN Processor, ss IN Stylesheet, xmldf IN DOMDOCUMENTFRAGMENT, cl IN OUT CLOB);
Table 181-6 PROCESSXSL Function and Procedure Parameters
Parameter | Description |
---|---|
|
|
|
|
|
XML document being transformed |
|
URL for the information being transformed |
|
|
|
Directory where processing output file is saved |
|
Processing output file |
|
|
|
|
This function reads content of a file into a CLOB
.
DBMS_XSLPROCESSOR.READ2CLOB( flocation IN VARCHAR2, fname IN VARCHAR2, csid IN NUMBER:=0) RETURN CLOB;
This function selects nodes which match the suplied path expression from a DOM tree, and returns the result of the selection.
DBMS_XSLPROCESSOR.SELECTNODES( n IN DBMS_XMLDOM.DOMNODE, pattern IN VARCHAR2, namespace IN VARCHAR2 := NULL) RETURN DBMS_XMLDOM.DOMNODELIST;
This function selects the first node from the tree that match the suplied path expression, and returns that node.
DBMS_XSLPROCESSOR.SELECTSINGLENODE( n IN DBMS_XMLDOM.DOMNODE, pattern IN VARCHAR2, namespace IN VARCHAR2 := NULL) RETURN DBMS_XMLDOM.DOMNODE;
This procedure sets errors to be sent to the specified file.
Note:
This subprogram has been deprecated, and is included only for reasons of backward compatibility.This procedure sets a top level parameter in the stylesheet. The parameter value must be a valid XPath
expression. Literal string values must be quoted.
This function transforms a node in a DOM tree using the given stylesheet, and returns the result of the transformation as a DOMDocumentFragment
.
This subprogram retrieves the value of the first node from the tree that matches the given pattern. You can use either a function or a procedure.
DBMS_XSLPROCESSOR.VALUEOF( n IN DBMS_XMLDOM.DOMNODE, pattern IN VARCHAR2, namespace IN VARCHAR2 := NULL) RETURN VARCHAR2;
DBMS_XSLPROCESSOR.VALUEOF( n IN DBMS_XMLDOM.DOMNODE, pattern IN VARCHAR2, val OUT VARCHAR2, namespace IN VARCHAR2 := NULL);