All Packages Previous Next

XSL Processor APIs

Extensible Stylesheet Language Transformation, abbreviated 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 PLSQL 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 PLSQL XML parser:

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


Types

Processor interface type

oProcessor

Stylesheet interface type

oStylesheet

Functions

onewProcessor
Returns a new processor instance
oprocessXSL(Processor, Stylesheet, DOMDocument)
Transforms input XML document using given DOMDocument and stylesheet
oprocessXSL(Processor, Stylesheet, DOMDocumentFragment)
Transforms input XML document fragment using given DOMDocumentFragment and stylesheet
oshowWarnings(Processor, BOOLEAN)
Turn warnings on or off
osetErrorLog(Processor, VARCHAR2)
Sets errors to be sent to the specified file
onewStylesheet(DOMDocument, VARCHAR2)
Returns a new stylesheet using the given DOMDocument and reference URL
onewStylesheet(VARCHAR2, VARCHAR2)
Returns a new stylesheet using the given input and reference URLs
otransformNode(DOMNode, Stylesheet)
Transforms a node in a DOM tree using the given stylesheet
oselectNodes(DOMNode, VARCHAR2)
          Selects nodes from a DOM tree which match the given pattern
oselectSingleNodes(DOMNode, VARCHAR2)
Selects the first node from the tree that matches the given pattern
ovalueOf(DOMNode, VARCHAR2)
Retrieves the value of the first node from the tree that matches the given pattern
osetParam(Stylesheet, VARCHAR2, VARCHAR2)
Sets the value of a top-level stylesheet parameter
oremoveParam(Stylesheet,  VARCHAR2)
Remove a top-level stylesheet parameter
oresetParams(Stylesheet)
Resets the top-level stylesheet parameters
ofreeStylesheet(Stylesheet)
          Free a stylesheet object
ofreeProcessor(Processor)
Free a processor object 

Types Description

Processor interface type description

oTYPE Processor IS RECORD ( ID VARCHAR2(5) );

Stylesheet interface type description

oTYPE Stylesheet IS RECORD ( ID VARCHAR2(5) );

Function Prototypes

onewProcessor

 

 

PURPOSE

Returns a new processor instance

SYNTAX

 FUNCTION newProcessor RETURN Processor;
PARAMETERS
None

RETURNS
A new processor instance

COMMENTS

This function must be called before the default behavior of Processor can be changed and if other processor methods need to be used.


oprocessXSL

 

 

PURPOSE

Transforms input XML document using given DOMDocument and stylesheet

SYNTAX

 PROCEDURE processXSL(p Processor, ss Stylesheet, xmldoc DOMDocument);
PARAMETERS
 p        (IN)-  processor instance
 ss       (IN)-  stylesheet instance
 xmldoc   (IN)-  xml document to be transformed
RETURNS
Nothing

COMMENTS

Any changes to the default processor behavior should be effected before calling this procedure.

An application error is raised if processing failed, for some reason.


oprocessXSL

 

 

PURPOSE

Transforms input XML document using given DOMDocumentFragment and stylesheet

SYNTAX

 PROCEDURE processXSL(p Processor, ss Stylesheet, xmldoc DOMDocumentFragment);
PARAMETERS
 p        (IN)-  processor instance
 ss       (IN)-  stylesheet instance
 xmldoc   (IN)-  xml document fragment to be transformed
RETURNS
Nothing

COMMENTS

Any changes to the default processor behavior should be effected before calling this procedure.

An application error is raised if processing failed, for some reason.


oshowWarnings

 

 

PURPOSE

Turn warnings on or off

SYNTAX

 PROCEDURE showWarnings(p Processor, yes BOOLEAN);
PARAMETERS
 p        (IN)-  processor instance
 yes      (IN)-  mode to set: TRUE - show warnings, FALSE - don't show warnings
RETURNS
Nothing

osetErrorLog

 

 

PURPOSE

Sets errors to be sent to the specified file

SYNTAX

 PROCEDURE setErrorLog(p Processor, fileName VARCHAR2);
PARAMETERS
 p        (IN)-  processor instance
 fileName (IN)-  complete path of the file to use as the error log
RETURNS
Nothing

onewStylesheet

 

 

PURPOSE

Create a new stylesheet using the given DOMDocument and reference URL

SYNTAX

 FUNCTION newStylesheet(inp DOMDocument, ref VARCHAR2) RETURN Stylesheet;
PARAMETERS
 inp      (IN)-  input document to use for construction
 ref      (IN)-  reference url
RETURNS
A new stylesheet instance

onewStylesheet

 

 

PURPOSE

Create a new stylesheet using the given input and reference URLs

SYNTAX

 FUNCTION newStylesheet(inp VARCHAR2, ref VARCHAR2) RETURN Stylesheet;
PARAMETERS
 inp      (IN)-  input url to use for construction
 ref      (IN)-  reference url
RETURNS
A new stylesheet instance

otransformNode

 

 

PURPOSE

Transforms a node in a DOM tree using the given stylesheet

SYNTAX

 FUNCTION transformNode(n DOMNode, ss Stylesheet) RETURN DOMDocumentFragment;
PARAMETERS
 n        (IN)-  DOM Node to transform
 ss       (IN)-  stylesheet to use
RETURNS
Result of the transformation

oselectNodes

 

 

PURPOSE

Selects nodes from a DOM tree which match the given pattern

SYNTAX

 FUNCTION selectNodes(n DOMNode, pattern VARCHAR2) RETURN DOMNodeList;
PARAMETERS
 n        (IN)-  DOM Node to transform
 pattern  (IN)-  pattern to use
RETURNS
Result of the selection

oselectSingleNodes

 

 

PURPOSE

Selects the first node from the tree that matches the given pattern

SYNTAX

 FUNCTION selectSingleNodes(n DOMNode, pattern VARCHAR2) RETURN DOMNode;
PARAMETERS
 n        (IN)-  DOM Node to transform
 pattern  (IN)-  pattern to use
RETURNS
Result of the selection

ovalueOf

 

 

PURPOSE

Retrieves the value of the first node from the tree that matches the given pattern

SYNTAX

 FUNCTION valueOf(n DOMNode, pattern VARCHAR2) RETURN VARCHAR2;
PARAMETERS
 n        (IN)-  DOM Node to transform
 pattern  (IN)-  pattern to use
RETURNS
Result of the selection

osetParam

 

 

PURPOSE

Sets a top level paramter in the stylesheet

SYNTAX

PROCEDURE setParam(ss Stylesheet, name VARCHAR2, value VARCHAR2) 
PARAMETERS
 ss        (IN)-  stylesheet
 name      (IN)-  name of the param
 value      (IN)-  value of the param

oremoveParam

 

 

PURPOSE

Removes a top level stylesheet parameter

SYNTAX

 PROCEDURE removeParam(ss Stylesheet, name VARCHAR2)
PARAMETERS
 ss       (IN)-  Stylesheet
 name  (IN)-  name of the parameter

oresetParams

 

 

PURPOSE

Resets the top-level stylesheet parameters

SYNTAX

 PROCEDURE resetParams(ss Stylesheet)
PARAMETERS
 ss        (IN)-  Stylesheet

ofreeStylesheet

 

 

PURPOSE

Frees a Stylesheet object

SYNTAX

 PROCEDURE freestylesheet(ss Stylesheet)
PARAMETERS
 ss        (IN)-  Stylesheet

ofreeProcessor

 

 

PURPOSE

Frees a Processor object

SYNTAX

 PROCEDURE freeProccessor(p Processor)
PARAMETERS
 p        (IN)-  Processor