Oracle9i XML API Reference - XDK and Oracle XML DB Release 2 (9.2) Part Number A96616-01 |
|
The XSL language processor is used to read XML documents and transform them into other XML documents with different styles. The C implementation of the XSL processor follows the XSL Transformations standard (version 1.0, November 16, 1999) and implements the required behavior of an XSL processor as specified in the XSLT specification.
This chapter describes the following sections:
Processes an XSL Stylesheet with an XML document source. Returns LPXERR_OK
on success, otherwise LPXERR_FAIL.
uword xslprocess( xmlctx *docctx, xmlctx *xslctx, xmlctx *resctx, xmlnode **result);
Processes an XSL Stylesheet with an XML document source. User can specify a list of toplevel parameters to be set before parsing begins. Returns LPXERR_OK
on success, otherwise LPXERR_FAIL.
uword xslprocessex( xmlctx *docctx, xmlctx *sctx, xmlctx *resctx, size-t nparams, oratext *params[], oratext *vals[], oratext *baseuri, xmlnode **result);
Processes an XSL Stylesheet with an XML document source. Returns LPXERR_OK
on success, otherwise LPXERR_FAIL.
This XSLT API are supposed to be used after the user:
xslinit()
,xslinit()
,xslsettextparam()
,xslsetoutput()
The function will process the given XML file (specified by docctx
) according to the XSL stylesheet, parameters, and output method. This call returns one of the following depending on the output scheme that the user selected:
xslgetresultdocgrag()
function to access the final Document Fragment created in context of the resctx()
set by a call to xslsetoutputdomctx()
.uword xslprocessxml( xslctx *xslSSctx, xmlctx *docctx, boolean normalize, ub4 resvd);
Processes an XSL Stylesheet with an XML document source. Returns LPXERR_OK
on success, otherwise LPXERR_FAIL.
This XSLT API are supposed to be used after the user:
xslinit()
,xslinit()
,xslsettextparam()
,xslsetoutput()
The function will process the given XML file (specified by docctx
) according to the XSL stylesheet, parameters, and output method. This call returns one of the following depending on the output scheme that the user selected:
xslgetresultdocgrag()
function to access the final Document Fragment created in context of the resctx()
set by a call to xslsetoutputdomctx()
.uword xslprocessxmldocfrag( xslctx *xslSSctx, xmlctx *docctx, xmlnode *docFrag, boolean normalize, ub4 resvd);
Creates and initializes an XSL context. Returns the pointer to the XSL context object if successful; otherwise NULL
.
xslctx* xslinit ( uword *err, xmlctx *xslctx, const oratext *baseURI, ub4 resvd);
Retrieves baseURI associated with XSL context. Returns the pointer to the base URI if successful; otherwise NULL
.
const oratext* xslgetbaseuri ( xslctx *xslSSctx);
Argument | IN / OUT | Description |
---|---|---|
xslSSctx |
(IN) |
The XSL processing context to be queried. |
Retrieves output DOM associated with the XSL context. Returns the pointer to the output DOM context object if successful; otherwise NULL
.
xmlctx* xslgetoutputdomctx( xslctx *xslSSctx);
Argument | IN / OUT | Description |
---|---|---|
xslSSctx |
(IN) |
The XSL processing context to be queried |
Retrieves SAX object associated with the XSL context. Returns the pointer to the output SAX object if successful; otherwise NULL
.
xmlsaxcb* xslgetoutputsax( xslctx *xslSSctx);
Argument | IN / OUT | Description |
---|---|---|
xslSSctx |
(IN) |
The XSL processing context to be queried |
Retrieves output stream associated with the XSL context. Returns the pointer to the output stream object if successful; otherwise NULL.
xmlstream* xslgetoutputstream( xslctx *xslSSctx);
Argument | IN / OUT | Description |
---|---|---|
xslSSctx |
(IN) |
The XSL processing context to be queried. |
Retrieves resultant doc fragment associated with the XSL context. Returns the pointer to the document fragment node if successful; otherwise NULL
.
xmlnode* xslgetresultdocfrag( xslctx *xslSSctx);
Argument | IN / OUT | Description |
---|---|---|
xslSSctx |
(IN) |
The XSL processing context to be queried. |
Retrieves XML context for XML stylesheet associated with XSL context. Returns the pointer to the XML context object of the XSL stylesheet if successful; otherwise NULL
.
xmlctx* xslgetxslctx( xslctx *xslSSctx);
Argument | IN / OUT | Description |
---|---|---|
xslSSctx |
(IN) |
The XSL processing context to be queried |
Sets a toplevel parameter (variable). Returns LPXERR_OK
on success, otherwise LPXERR_FAIL
.
uword xslsettextparam ( xslctx *xslSSctx, const oratext *param_name, const oratext *param_value);
Argument | IN / OUT | Description |
---|---|---|
xslSSctx |
(IN) |
The XSL processing context to be queried. |
param_name |
(IN) |
The name of parameter (variable) whose value is to be set. |
param_value |
(IN) |
The parameter value. |
Returns a top level parameter(variable) value. Returns the pointer to the variable/parameter value if successful, otherwise NULL
.
const oratext *xslgettextparam( xslctx *xslSSctx, const oratext *param_name);
Argument | IN / OUT | Description |
---|---|---|
xslSSctx |
(IN) |
The XSL processing context. |
param_name |
(IN) |
The name of parameter (variable) whose value is to be retrieved. |
Sets XML context to store processing result (as DOM). Returns LPXERR_OK
on success, otherwise LPXERR_FAIL
.
A call to xslsetoutputdomctx() overrides
any previous output method set using any previous calls to xslsetoutputdomctx()
, xslsetoutputstream ()
or xslsetoutputsax()
. Any subsequent processing of the XML input will be stored in form of a Document Fragment in the xmlctx
specified by resctx
.
xslgetoutputdomctx()
can be used to retrieve the presently set resctx
. If no DOM context is set or a call to xslsetoutputdomctx()
has been overridden by a
subsequent call to xslsetoutputstream()
or xslsetoutputsax()
, then xslgetoutputdomctx()
will return a NULL
context indicating that the present output mode is not a DOM output mode.
uword xslsetoutputdomctx( xslctx *xslSSctx, xmlctx *resctx);
Sets XSLT output encoding. Returns LPXERR_OK
on success, otherwise LPXERR_FAIL
. Overrides the XSL Stylesheet settings.
This call is used to set an output method equivalent to XSL processing directive xsl:output encoding ="...".
If the XSL stylesheet contains one or more similar statements, then this function will override the effect of any previously present statements in XSL stylesheet.
uword xslsetoutputencoding( xslctx *xslSSctx, oratext* outcoding);
Argument | IN / OUT | Description |
---|---|---|
xslSSctx |
(IN) |
The XSL processing context |
outcoding |
(IN) |
Encoding name for the output encoding |
Sets XSLT output method. Returns LPXERR_OK
on success, otherwise LPXERR_FAIL
. Overrides the XSL Stylesheet settings.
This call is used to set an output method equivalent to XSL processing directive xsl:output method = "text/xml/html"
. If the XSL stylesheet contains one or more similar statements, then this function will override the effect of any previously present statements in XSL stylesheet.
uword xslsetoutputmethod( xslctx *xslSSctx, xsloutputmethod method, ub4 resvd);
Argument | IN / OUT | Description |
---|---|---|
xslSSctx |
(IN) |
The XSL processing context |
method |
(IN) |
Output method to be selected |
resvd |
Reserved for future; must set to |
Sets the SAX based events to be generated for the output. Returns LPXERR_OK
on success, otherwise LPXERR_FAIL
.
The user can make a call to xslsetoutputsazctx()
to set the SAX context to be used by the SAX callbacks. If none is set, NULL
will be passed to the SAX callbacks as SAX context. Note: just setting the callbacks is sufficient to invoke the SAX callbacks.
uword xslsetoutputsax( xslctx *xslSSctx, xmlsaxcb *s);
Argument | IN / OUT | Description |
---|---|---|
xslSSctx |
(IN) |
The XSL processing context |
s |
(IN) |
The SAX callbacks to be used to generate the SAX events |
Sets the SAX based events to be generated for the output. Returns LPXERR_OK
on success, otherwise LPXERR_FAIL
.
The user can make a call to xslsetoutputsazctx()
to set the SAX context to be used by the SAX callbacks. If none is set, NULL
will be passed to the SAX callbacks as SAX context. Note: just setting the callbacks is sufficient to invoke the SAX callbacks.
uword xslsetoutputsaxctx( xslctx *xslSSctx, void *saxctx);
Argument | IN / OUT | Description |
---|---|---|
xslSSctx |
(IN) |
The XSL processing context |
saxctx |
(IN) |
the SAX context |
Sets the stream object specifying callbacks to generate the text stream based output. Returns LPXERR_OK
on success, otherwise LPXERR_FAIL
.
uword xslsetoutputstream( xslctx *xslSSctx, xmlstream *stream);
Argument | IN / OUT | Description |
---|---|---|
stream |
(IN) |
The stream structure giving the callbacks to be used. |
xslSSctx |
(IN) |
The XSL processing context |
Resets all the top level parameters added. Returns LPXERR_OK
on success, otherwise LPXERR_FAIL.
uword xslresetallparams( xslctx *xslSSctx);
Argument | IN / OUT | Description |
---|---|---|
xslSSctx |
(IN) |
The XSL processing context |
Terminates an XSLT context object. Returns LPXERR_OK
on success, otherwise LPXERR_FAIL
.
uword xslterm( xslctx *xslSSctx);
Argument | IN / OUT | Description |
---|---|---|
xslSSctx |
(IN) |
The XSL processing context. |
Creates an XPath context. Returns an XPath context object; this call never fails.
xpctx *xpmakexpathctx( xmlctx *ctx, xmlnode *xslnode, xmlnode* xml_node, oratext* baseURI, size-t nctxels, xmlnode ** ctxnodes);
Frees an XPath context.
void xpfreexpathctx( xpctx *xctx);
Argument | IN / OUT | Description |
---|---|---|
xctx |
(IN) |
The XPath context to be freed. |
Parses an XPath expression. Returns the expression tree on success; otherwise, NULL.
xpexpr *xpparsexpathexpr( xpctx *xctx, oratext *expr, sword *err);
Argument | IN / OUT | Description |
---|---|---|
xctx |
(IN/OUT) |
The XPath context |
expr |
(IN) |
The expression in the form of a string |
err |
(OUT) |
The error code |
Evaluates an XPath expression. Returns the result object on success; otherwise, NULL.
The type of the result object, obtained using xpgetxpobjtyp()
, is one of the following:
xpobj *xpevalxpathexpr( xpctx *xctx, xpexpr *exprtree, sword *err);
Argument | IN / OUT | Description |
---|---|---|
xctx |
(IN/OUT) |
The XPath context |
exprtree |
(IN) |
The expression in the form of a tree |
err |
(OUT) |
The error code |
Retrieves values of evaluated xpath expression result. Returns the expression value on success; otherwise, NULL.
xpobjtyp xpgetxpobjtyp( xpobj *xobj);
Argument | IN / OUT | Description |
---|---|---|
xobj |
(IN) |
The expression object |
Retrieves values of evaluated xpath expression result. Returns the expression value on success; otherwise, NULL.
boolean xpgetbooleanval (xpobj *xobj);
Argument | IN / OUT | Description |
---|---|---|
xobj |
(IN) |
The expression object |
Retrieves values of evaluated xpath expression result. Returns the expression value on success; otherwise, NULL.
double xpgetnumval( xpobj *xobj);
Argument | IN / OUT | Description |
---|---|---|
xobj |
(IN) |
The expression object |
Retrieves values of evaluated xpath expression result. Returns the expression value on success; otherwise, NULL.
oratext* xpgetstrval( xpobj *xobj);
Argument | IN / OUT | Description |
---|---|---|
xobj |
(IN) |
The expression object. |
Retrieves values of evaluated xpath expression result. Returns the expression value on success; otherwise, NULL.
xpnset* xpgetnsetval( xpobj *xobj);
Argument | IN / OUT | Description |
---|---|---|
xobj |
(IN) |
The expression object. |
Retrieves values of evaluated xpath expression result. Returns the expression value on success; otherwise, NULL.
xmlnode* xpgetrtfragval(xpobj *xobj);
Argument | IN / OUT | Description |
---|---|---|
xobj |
(IN) |
The expression object |
Retrieves values of evaluated xpath expression result. Returns the expression value on success; otherwise, NULL.
xpnsetele* xpgetfirstnsetelem( xpnset *nset);
Argument | IN / OUT | Description |
---|---|---|
nset |
(IN) |
The node set |
Retrieves values of evaluated xpath expression result. Returns the expression value on success; otherwise, NULL.
xpnsetele* xpgetnextnsetelem( xpnsetele *nsetele);
Argument | IN / OUT | Description |
---|---|---|
xpnstele* |
(IN) |
The node set element. |
Retrieves values of evaluated xpath expression result. Returns the expression value on success; otherwise, NULL.
xmlnode *xpgetnsetelemnode( xpnsetele *nsetele);
Argument | IN / OUT | Description |
---|---|---|
xpnstele* |
(IN) |
The node set element |
|
Copyright © 2001, 2002 Oracle Corporation. All Rights Reserved. |
|