Skip Headers

Oracle® XML API Reference
10g Release 1 (10.1)

Part Number B10789-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

Using XSLTVM

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:

  1. Create/Use an XML meta context object.

    xctx = XmlCreate(,...);

  2. Create/Use an XSLT Compiler object.

    comp = XmlXvmCreateComp(xctx);

  3. Compile an XSLT stylesheets and cache the result bytecode.

    code = XmlXvmCompileFile(comp, xslFile, baseuri, flags, );

  4. 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);

  5. Set a stylesheet bytecode to the XSLTVM object.

    len = XmlXvmGetBytecodeLength(code, ); err = XmlXvmSetBytecodeBuffer(vm, code, len);

  6. Transform an instance XML document.

    err = XmlXvmTransformFile(vm, xmlFile, baseuri);

  7. Clean.

    XmlXvmDestroy(vm);

    XmlXvmDestroyComp(comp);

    XmlDestroy(xctx);