PL/SQL Packages and Types Reference 10g Release 1 (10.1) Part Number B10802-01 |
|
|
View PDF |
With DBMS_XSLPROCESSOR, you
can access the contents and structure of XML documents. 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. This PL/SQL implementation of the XSL processor followed the W3C XSLT working draft rev WD-xslt-19990813 and included the required behavior of an XSL processor in terms of how it must read XSLT stylesheets and the transformation it must effect.
The following is the default behavior for this PL/SQL XSL Processor:
This chapter contains the following topics:
Write content of a CLOB
into a file.
PROCEDURE clob2file( cl CLOB; flocation VARCHAR2, fname VARCHAR2, csid IN NUMBER:=0);
Parameter | IN / OUT | Description |
---|---|---|
clob |
- |
File directory |
flocation |
- |
File directory |
fname |
- |
File name |
csid |
(IN) |
Character set id of the file |
Frees a Processor
object.
PROCEDURE freeProccessor( p Processor);
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
Processor. |
Frees a Stylesheet
object.
PROCEDURE freeStylesheet( ss Stylesheet);
Parameter | IN / OUT | Description |
---|---|---|
ss |
(IN) |
Stylesheet. |
Returns a new Processor
instance. This function must be called before the default behavior of Processor
can be changed and if other processor methods need to be used.
FUNCTION newProcessor RETURN Processor;
Creates and returns a new Stylesheet
instance. The options are described in the following table.
Parameter | IN / OUT | Description |
---|---|---|
xmldoc |
(IN) |
|
inp |
(IN) |
Input URL to use for construction. |
ref |
(IN) |
Reference URL |
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. The options are described in the following table.
Read content of a file into a CLOB
.
FUJNCTION read2clob( flocation VARCHAR2, fname VARCHAR2, csid IN NUMBER:=0) RETURN CLOB;
Parameter | IN / OUT | Description |
---|---|---|
flocation |
- |
File directory |
fname |
- |
File name |
csid |
(IN) |
Character set id of the file |
Removes a top level stylesheet parameter.
PROCEDURE removeParam( ss Stylesheet, name VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
ss |
(IN) |
|
name |
(IN) |
Name of the parameter. |
Resets the top-level stylesheet parameters.
PROCEDURE resetParams( ss Stylesheet);
Parameter | IN / OUT | Description |
---|---|---|
ss |
(IN) |
|
Selects nodes which match the given pattern from a DOM tree, and returns the result of the selection.
FUNCTION selectNodes( n DOMNode, pattern VARCHAR2) RETURN DOMNodeList;
Parameter | IN / OUT | Description |
---|---|---|
n |
(IN) |
Root |
pattern |
(IN) |
Pattern to use. |
Selects the first node from the tree that matches the given pattern, and returns that node.
FUNCTION selectSingleNode( n DOMNode, pattern VARCHAR2) RETURN DOMNode;
Parameter | IN / OUT | Description |
---|---|---|
n |
(IN) |
Root |
pattern |
(IN) |
Pattern to use. |
Sets errors to be sent to the specified file.
PROCEDURE setErrorLog( p Processor, fileName VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
|
fileName |
(IN) |
complete path of the file to use as the error log. |
Sets a top level parameter in the stylesheet. The parameter value must be a valid XPath
expression. Literal string values must be quoted.
PROCEDURE setParam( ss Stylesheet, name VARCHAR2, value VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
ss |
(IN) |
|
name |
(IN) |
Name of the parameter. |
value |
(IN) |
Value of the parameter. |
Turns warnings on (TRUE)
or off (FALSE)
.
PROCEDURE showWarnings( p Processor, yes BOOLEAN);
Parameter | IN / OUT | Description |
---|---|---|
p |
(IN) |
|
yes |
(IN) |
Mode to set: |
Transforms a node in a DOM tree using the given stylesheet, and returns the result of the transformation as a DOMDocumentFragment
.
FUNCTION transformNode( n DOMNode, ss Stylesheet) RETURN DOMDocumentFragment;
Parameter | IN / OUT | Description |
---|---|---|
n |
(IN) |
|
ss |
(IN) |
Stylesheet to use. |
Retrieves the value of the first node from the tree that matches the given pattern.
PROCEDURE valueOf( n DOMNode, pattern VARCHAR2, val OUT VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
n |
(IN) |
Node whose value is being retrieved. |
pattern |
(IN) |
Pattern to use. |
val |
(OUT) |
Retrieved value. |