Oracle® XML API Reference 10g Release 1 (10.1) Part Number B10789-01 |
|
|
View PDF |
XSLT Virtual Machine is the software implementation of a "CPU" designed to run compiled XSLT code. A concept of virtual machine assumes a compiler compiling XSLT stylesheets to a sequence of byte codes or machine instructions for the "XSLT CPU". The byte-code program is a platform-independent sequence of 2-byte units. It can be stored, cached and run on different XSLTVM. The XSLTVM uses the bytecode programs to transform instance XML documents. This approach clearly separates compile (design)-time from run-time computations and specifies a uniform way of exchanging data between instructions.
A typical scenario of using the package APIs has the following steps:
Create/Use an XML meta context object.
xctx = XmlCreate(,...);
Create/Use an XSLT Compiler object.
comp = XmlXvmCreateComp(xctx);
Compile an XSLT stylesheets and cache the result bytecode.
code = XmlXvmCompileFile(comp, xslFile, baseuri, flags, );
Create/Use an XSLTVM object. The explicit stack size setting are needed when XSLTVM terminates with "... Stack Overflow" message or when smaller memory footprints are required (see XmlXvmCreate
).
vm = XmlXvmCreate(xctx, "StringStack", 32, "NodeStack", 24, NULL);
Set a stylesheet bytecode to the XSLTVM object.
len = XmlXvmGetBytecodeLength(code, ); err = XmlXvmSetBytecodeBuffer(vm, code, len);
Transform an instance XML document.
err = XmlXvmTransformFile(vm, xmlFile, baseuri);
Clean.
XmlXvmDestroy(vm);
XmlXvmDestroyComp(comp);
XmlDestroy(xctx);