Packages: All | Callback | DOM | Range | SAX | Schema | Traversal | XML | XPath | XPointer | XSLT | XSLTVM | Functions | Datatypes |
(1) Create/Use an XML meta context object. xctx = XmlCreate(&err,...);
(2) Create/Use an XSLT Compiler object. comp = XmlXvmCreateComp(xctx);
(3) Compile an XSLT stylesheets and store/cash the result bytecode. code = XmlXvmCompileFile(comp, xslFile, baseuri, flags, &err);
(4) Create/Use an XSLTVM object. The explicit stack size seting 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); err = XmlXvmSetBytecodeBuffer(vm, code, len);
(6) Transform an instance XML document. err = XmlXvmTransformFile(vm, xmlFile, baseuri);
(7) Clean. XmlXvmDestroy(vm); XmlXvmDestroyComp(comp); XmlDestroy(xctx);
Function | Interface | Description |
---|---|---|
XMLXVM_DEBUG_F | XSLTVM | XML XSLT VM debug function |
XmlXvmCompileBuffer | XSLTC | Compile an XSLT stylesheet from buffer into bytecode |
XmlXvmCompileDom | XSLTC | Compile an XSLT stylesheet from DOM into bytecode |
XmlXvmCompileFile | XSLTC | Compile XSLT stylesheet from file into bytecode |
XmlXvmCompileURI | XSLTC | Compile XSLT stylesheet from URI into bytecode |
XmlXvmCompileXPath | XSLTC | Compiles an XPath expression |
XmlXvmCreate | XSLTVM | Create an XSLT virtual machine |
XmlXvmCreateComp | XSLTC | Create an XSLT compiler |
XmlXvmDestroy | XSLTVM | Destroys an XSLT virtual machine |
XmlXvmDestroyComp | XSLTC | Destroys an XSLT compiler object |
XmlXvmEvaluateXPath | XSLTVM | Evaluate already-compiled XPath expression |
XmlXvmGetBytecodeLength | XSLTC | Returns the bytecode length |
XmlXvmGetObjectBoolean | XSLTVM | Get boolean value of XPath object |
XmlXvmGetObjectNSetNode | XSLTVM | Get node from nodeset-type XPath object |
XmlXvmGetObjectNSetNum | XSLTVM | Get number of of nodes in nodeset-type XPath object |
XmlXvmGetObjectNumber | XSLTVM | Get number from XPath object |
XmlXvmGetObjectString | XSLTVM | Get string from XPath object |
XmlXvmGetObjectType | XSLTVM | Get XPath object type |
XmlXvmGetOutputDom | XSLTVM | Returns the output DOM |
XmlXvmResetParams | XSLTVM | Resets the stylesheet top-level text params. |
XmlXvmSetBaseURI | XSLTVM | Sets the base URI for the XSLTVM |
XmlXvmSetBytecodeBuffer | XSLTVM | Set the compiled byte-code |
XmlXvmSetBytecodeFile | XSLTVM | Set the compiled bytecode from file |
XmlXvmSetBytecodeURI | XSLTVM | Set the compiled byte-code |
XmlXvmSetDebugFunc | XSLTVM | Set a callback function for debuging |
XmlXvmSetOutputDom | XSLTVM | Sets the XSLTVM to output document node. |
XmlXvmSetOutputEncoding | XSLTVM | Sets the encoding for the XSLTVM output |
XmlXvmSetOutputSax | XSLTVM | Set XSLTVM to output SAX |
XmlXvmSetOutputStream | XSLTVM | Set the XSLTVM output to a user-defined stream |
XmlXvmSetTextParam | XSLTVM | Set the stylesheet top-level text param. |
XmlXvmTransformBuffer | XSLTVM | Run compiled XSLT stylesheet on XML document in memory |
XmlXvmTransformDom | XSLTVM | Run compiled XSLT stylesheet on XML document as DOM |
XmlXvmTransformFile | XSLTVM | Run compiled XSLT stylesheet on XML document in file |
XmlXvmTransformURI | XSLTVM | Run compiled XSLT stylesheet on XML document from URI |
Function | Description |
---|---|
XmlXvmCompileBuffer | Compile an XSLT stylesheet from buffer into bytecode |
XmlXvmCompileDom | Compile an XSLT stylesheet from DOM into bytecode |
XmlXvmCompileFile | Compile XSLT stylesheet from file into bytecode |
XmlXvmCompileURI | Compile XSLT stylesheet from URI into bytecode |
XmlXvmCompileXPath | Compiles an XPath expression |
XmlXvmCreateComp | Create an XSLT compiler |
XmlXvmDestroyComp | Destroys an XSLT compiler object |
XmlXvmGetBytecodeLength | Returns the bytecode length |
Function | Description |
---|---|
XMLXVM_DEBUG_F | XML XSLT VM debug function |
XmlXvmCreate | Create an XSLT virtual machine |
XmlXvmDestroy | Destroys an XSLT virtual machine |
XmlXvmEvaluateXPath | Evaluate already-compiled XPath expression |
XmlXvmGetObjectBoolean | Get boolean value of XPath object |
XmlXvmGetObjectNSetNode | Get node from nodeset-type XPath object |
XmlXvmGetObjectNSetNum | Get number of of nodes in nodeset-type XPath object |
XmlXvmGetObjectNumber | Get number from XPath object |
XmlXvmGetObjectString | Get string from XPath object |
XmlXvmGetObjectType | Get XPath object type |
XmlXvmGetOutputDom | Returns the output DOM |
XmlXvmResetParams | Resets the stylesheet top-level text params. |
XmlXvmSetBaseURI | Sets the base URI for the XSLTVM |
XmlXvmSetBytecodeBuffer | Set the compiled byte-code |
XmlXvmSetBytecodeFile | Set the compiled bytecode from file |
XmlXvmSetBytecodeURI | Set the compiled byte-code |
XmlXvmSetDebugFunc | Set a callback function for debuging |
XmlXvmSetOutputDom | Sets the XSLTVM to output document node. |
XmlXvmSetOutputEncoding | Sets the encoding for the XSLTVM output |
XmlXvmSetOutputSax | Set XSLTVM to output SAX |
XmlXvmSetOutputStream | Set the XSLTVM output to a user-defined stream |
XmlXvmSetTextParam | Set the stylesheet top-level text param. |
XmlXvmTransformBuffer | Run compiled XSLT stylesheet on XML document in memory |
XmlXvmTransformDom | Run compiled XSLT stylesheet on XML document as DOM |
XmlXvmTransformFile | Run compiled XSLT stylesheet on XML document in file |
XmlXvmTransformURI | Run compiled XSLT stylesheet on XML document from URI |
Name | XMLXVM_DEBUG_F | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Interface | XSLTVM | ||||||||||||
Purpose | XML XSLT VM debug function | ||||||||||||
Prototype | #define XMLXVM_DEBUG_F(func, line, file, obj, n) \ void func(ub2 line, oratext *file, xvmobj *obj, ub4 n) | ||||||||||||
Arguments |
| ||||||||||||
Returns | (void) | ||||||||||||
Description | Debug callback function for XSLT VM
| ||||||||||||
See Also | XmlXvmSetDebugFunc |
Name | XmlXvmCompileBuffer | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Interface | XSLTC | ||||||||||||||||||
Purpose | Compile an XSLT stylesheet from buffer into bytecode | ||||||||||||||||||
Prototype | ub2 *XmlXvmCompileBuffer(xmlxvmcomp *comp, oratext *buffer, ub4 length, oratext *baseURI, xmlxvmflag flags, xmlerr *error); | ||||||||||||||||||
Arguments |
| ||||||||||||||||||
Returns | (ub2 *) bytecode or NULL on error | ||||||||||||||||||
Description | Compile an XSLT stylesheet from buffer into bytecode Compiler flags could be one or more of the following: XMLXVM_DEBUG - forces compiler to include debug information into the bytecode XMLXVM_STRIPSPACE - same as <xsl:strip-space elements="*"/>. The generated bytecode resides in a compiler buffer which is freed when next stylesheet is compiled or when compiler object is deleted. Hence, if the bytecode is to be reused it should be copied into another location.
| ||||||||||||||||||
See Also | XmlXvmCompileFile, XmlXvmCompileURI, XmlXvmCompileDom |
Name | XmlXvmCompileDom | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Interface | XSLTC | ||||||||||||
Purpose | Compile an XSLT stylesheet from DOM into bytecode | ||||||||||||
Prototype | ub2 *XmlXvmCompileDom(xmlxvmcomp *comp, xmldocnode *root, xmlxvmflag flags, xmlerr *error); | ||||||||||||
Arguments |
| ||||||||||||
Returns | (ub2 *) bytecode or NULL on error | ||||||||||||
Description | Compile an XSLT stylesheet from DOM into bytecode Compiler flags could be one or more of the following: XMLXVM_DEBUG - forces compiler to include debug information into the bytecode XMLXVM_STRIPSPACE - same as <xsl:strip-space elements="*"/>. The generated bytecode resides in a compiler buffer which is freed when next stylesheet is compiled or when compiler object is deleted. Hence, if the bytecode is to be reused it should be copied into another location.
| ||||||||||||
Example | comp = XmlXvmCreateComp(xctx); code = XmlXvmCompileDom(comp, root, XMLXVM_DEBUG, &err); | ||||||||||||
See Also | XmlXvmCompileFile, XmlXvmCompileBuffer, XmlXvmCompileURI |
Name | XmlXvmCompileFile | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Interface | XSLTC | |||||||||||||||
Purpose | Compile XSLT stylesheet from file into bytecode | |||||||||||||||
Prototype | ub2 *XmlXvmCompileFile(xmlxvmcomp *comp, oratext *path, oratext *baseURI, xmlxvmflag flags, xmlerr *error); | |||||||||||||||
Arguments |
| |||||||||||||||
Returns | (ub2 *) bytecode or NULL on error | |||||||||||||||
Description | Compile XSLT stylesheet from file into bytecode. Compiler flags could be one or more of the following: XMLXVM_DEBUG - forces compiler to include debug information into the bytecode XMLXVM_STRIPSPACE - same as <xsl:strip-space elements="*"/>. The generated bytecode resides in a compiler buffer which is freed when next stylesheet is compiled or when compiler object is deleted. Hence, if the bytecode is to be reused it should be copied into another location.
| |||||||||||||||
Example | comp = XmlXvmCreateComp(xctx); code = XmlXvmCompileFile(comp, xslFile1, baseuri, 0, &err); ... (copy the code) code = XmlXvmCompileFile(comp, xslFile2, baseuri, 0, &err); ... (copy the code) | |||||||||||||||
See Also | XmlXvmCompileURI, XmlXvmCompileBuffer, XmlXvmCompileDom |
Name | XmlXvmCompileURI | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Interface | XSLTC | ||||||||||||
Purpose | Compile XSLT stylesheet from URI into bytecode | ||||||||||||
Prototype | ub2 *XmlXvmCompileURI(xmlxvmcomp *comp, oratext *uri, xmlxvmflag flags, xmlerr *error); | ||||||||||||
Arguments |
| ||||||||||||
Returns | (ub2 *) bytecode or NULL on error | ||||||||||||
Description | Compile XSLT stylesheet from URI into bytecode Compiler flags could be one or more of the following: XMLXVM_DEBUG - forces compiler to include debug information into the bytecode XMLXVM_STRIPSPACE - same as <xsl:strip-space elements="*"/>. The generated bytecode resides in a compiler buffer which is freed when next stylesheet is compiled or when compiler object is deleted. Hence, if the bytecode is to be reused it should be copied into another location.
| ||||||||||||
Example | comp = XmlXvmCreateComp(xctx); code = XmlXvmCompileURI(comp, xslFile1, uri, XMLXVM_DEBUG, &err); ... (copy the code) code = XmlXvmCompileURI(comp, xslFile2, uri, XMLXVM_STRIPSPACE, &err); ... (copy the code) | ||||||||||||
See Also | XmlXvmCompileFile, XmlXvmCompileBuffer, XmlXvmCompileDom |
Name | XmlXvmCompileXPath | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Interface | XSLTC | ||||||||||||
Purpose | Compiles an XPath expression | ||||||||||||
Prototype | ub2 *XmlXvmCompileXPath(xmlxvmcomp *comp, oratext *xpath, oratext **pfxmap, xmlerr *error); | ||||||||||||
Arguments |
| ||||||||||||
Returns | (ub2 *) XPath expression bytecode or NULL on error | ||||||||||||
Description | Compiles an XPath expression. The optional pfxmap is used
to map namespace prefixes to URIs in the XPath expression.
It is an array of prefix, URI values, endinging in NULL,
for example: oratext *my_pfx_map[] = "pfx1", "/this/that/pfx1/uri", "pfx2", "/this/that/another/pfx2/uri", NULL ;
| ||||||||||||
Example | comp = XmlXvmCreateComp(xctx); code = XmlXvmCompileXPath(comp, "pfx1:doc/employee[4]", my_pfx_map, &err); |
Name | XmlXvmCreate | ||||||
---|---|---|---|---|---|---|---|
Interface | XSLTVM | ||||||
Purpose | Create an XSLT virtual machine | ||||||
Prototype | xmlxvm *XmlXvmCreate(xmlctx *xctx, ...); | ||||||
Arguments |
| ||||||
Returns | (xmlxvm *) XSLT virtual machine object, or NULL on error | ||||||
Description | Create an XSLT virtual machine.
Zero or more of the following XSLTVM properties could be set by
using this API: "VMStack", size, - sets the size[Kbyte] of the main VM stack. Default size is 4K. "NodeStack", size, - sets the size[Kbyte] of the node-stack Default size is 16K. "StringStack", size - sets the size[Kbyte] of the string-stack Default size is 64K. If the stack size is not specified the default size is used. The explicit stack size seting is needed when XSLTVM terminates with "Stack Overflow" message or when smaller memory footprints are required.
| ||||||
Example | vm = XmlXvmCreate(xctx); XmlXvmDestroy(vm); ... vm = XmlXvmCreate(xctx, "VMStack", 10, "NodeStack", 24, "StringStack", 24, NULL); | ||||||
See Also | XmlXvmDestroy |
Name | XmlXvmCreateComp | |||
---|---|---|---|---|
Interface | XSLTC | |||
Purpose | Create an XSLT compiler | |||
Prototype | xmlxvmcomp *XmlXvmCreateComp(xmlctx *xctx); | |||
Arguments |
| |||
Returns | (xmlxvmcomp *) XSLT compiler object, or NULL on error | |||
Description | Create an XSLT compiler object. The XSLT compiler is used to compile
XSLT stylesheets into bytecode.
| |||
Example | comp = XmlXvmCreateComp(xctx); code = XmlXvmCompileFile(comp, xslFile1, baseuri, 0, &err); code = XmlXvmCompileFile(comp, xslFile2, baseuri, 0, &err); ... -- the following is an example of bytecode instructions sequence: ... 14. <xsl:apply-templates select="@* | node()"/> 39 PUSHCUR 40 ATTRIBUTE node() node() 43 PUSHCUR 44 CHILD node() node() 47 UNION 48 PUSHCTX [loop][context] 49 FOREACH code: @-8 51 PUSHCUR 52 MATCH 0 54 CALLTEMPLATE 55 BRA code: @6 57 TESTCURNDTYPE 1 59 BNO code: @-3 ... | |||
See Also | XmlXvmDestroyComp |
Name | XmlXvmDestroy | ||||||
---|---|---|---|---|---|---|---|
Interface | XSLTVM | ||||||
Purpose | Destroys an XSLT virtual machine | ||||||
Prototype | void XmlXvmDestroy(xmlxvm *vm); | ||||||
Arguments |
| ||||||
Returns | (void) | ||||||
Description | Destroys an XSLT virtual machine
| ||||||
See Also | XmlXvmCreate |
Name | XmlXvmDestroyComp | |||
---|---|---|---|---|
Interface | XSLTC | |||
Purpose | Destroys an XSLT compiler object | |||
Prototype | void XmlXvmDestroyComp(xmlxvmcomp *comp); | |||
Arguments |
| |||
Returns | (void) | |||
Description | Destroys an XSLT compiler object
| |||
See Also | XmlXvmCreateComp |
Name | XmlXvmEvaluateXPath | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Interface | XSLTVM | |||||||||||||||
Purpose | Evaluate already-compiled XPath expression | |||||||||||||||
Prototype | xvmobj *XmlXvmEvaluateXPath(xmlxvm *vm, ub2 *bytecode, ub4 ctxpos, ub4 ctxsize, xmlnode *ctxnode); | |||||||||||||||
Arguments |
| |||||||||||||||
Returns | (xvmobj *) XPath object | |||||||||||||||
Description | Evaluate already-compiled XPath expression
| |||||||||||||||
Example | code = XmlXvmCompileXPath(comp, xpath, NULL, &err); obj = XmlXvmEvaluateXPath(vm, code, 1, 1, node); switch (XmlXvmGetObjectType(obj)) ... |
Name | XmlXvmGetBytecodeLength | ||||||
---|---|---|---|---|---|---|---|
Interface | XSLTC | ||||||
Purpose | Returns the bytecode length | ||||||
Prototype | ub4 XmlXvmGetBytecodeLength(ub2 *bytecode, xmlerr *error); | ||||||
Arguments |
| ||||||
Returns | (ub4) The bytecode length in bytes. | ||||||
Description | The bytecode length is needed when the bytecode is to be copied
or when it is set into XSLTVM.
| ||||||
Example | len = XmlXvmGetBytecodeLength(code, &err); err = XmlXvmSetBytecodeBuffer (vm, code, len); |
Name | XmlXvmGetObjectBoolean | |||
---|---|---|---|---|
Interface | XSLTVM | |||
Purpose | Get boolean value of XPath object | |||
Prototype | boolean XmlXvmGetObjectBoolean(xvmobj *obj); | |||
Arguments |
| |||
Returns | (boolean) value of an XPath object | |||
Description | Get boolean value of XPath object
| |||
Example | obj = XmlXvmEvaluateXPath(vm, code, 1, 1, node); switch (XmlXvmGetObjectType(obj)) case XMLXVM_TYPE_BOOL: bool = XmlXvmGetObjectBoolean(obj); ... | |||
See Also | XmlXvmGetObjectType, XmlXvmGetObjectNSetNum, XmlXvmGetObjectNSetNode, XmlXvmGetObjectNumber, XmlXvmGetObjectBoolean |
Name | XmlXvmGetObjectNSetNode | ||||||
---|---|---|---|---|---|---|---|
Interface | XSLTVM | ||||||
Purpose | Get node from nodeset-type XPath object | ||||||
Prototype | xmlnode *XmlXvmGetObjectNSetNode(xvmobj *obj, ub4 i); | ||||||
Arguments |
| ||||||
Returns | (xmlnode *) The object type or values. | ||||||
Description | Get node from nodeset-type XPath object
| ||||||
Example | obj = XmlXvmEvaluateXPath(vm, code, 1, 1, node); switch (XmlXvmGetObjectType(obj)) case XMLXVM_TYPE_NDSET: objnum = XmlXvmGetObjectNSetNum(obj); for (i = 0; i < objnum; i++) node = XmlXvmGetObjectNSetNode(obj, i); ... | ||||||
See Also | XmlXvmGetObjectType, XmlXvmGetObjectNSetNum, XmlXvmGetObjectString, XmlXvmGetObjectNumber, XmlXvmGetObjectBoolean |
Name | XmlXvmGetObjectNSetNum | |||
---|---|---|---|---|
Interface | XSLTVM | |||
Purpose | Get number of of nodes in nodeset-type XPath object | |||
Prototype | ub4 XmlXvmGetObjectNSetNum(xvmobj *obj); | |||
Arguments |
| |||
Returns | (ub4) number of nodes in nodeset | |||
Description | Get number of of nodes in nodeset-type XPath object
| |||
Example | obj = XmlXvmEvaluateXPath(vm, code, 1, 1, node); switch (XmlXvmGetObjectType(obj)) case XMLXVM_TYPE_NDSET: objnum = XmlXvmGetObjectNSetNum(obj); for (i = 0; i < objnum; i++) node = XmlXvmGetObjectNSetNode(obj, i); ... | |||
See Also | XmlXvmGetObjectType, XmlXvmGetObjectNSetNode, XmlXvmGetObjectString, XmlXvmGetObjectNumber, XmlXvmGetObjectBoolean |
Name | XmlXvmGetObjectNumber | |||
---|---|---|---|---|
Interface | XSLTVM | |||
Purpose | Get number from XPath object | |||
Prototype | double XmlXvmGetObjectNumber(xvmobj *obj); | |||
Arguments |
| |||
Returns | (double) number | |||
Description | Get number from XPath object
| |||
Example | obj = XmlXvmEvaluateXPath(vm, code, 1, 1, node); switch (XmlXvmGetObjectType(obj)) case XMLXVM_TYPE_NUM: num = XmlXvmGetObjectNumber(obj); ... | |||
See Also | XmlXvmGetObjectType, XmlXvmGetObjectNSetNum, XmlXvmGetObjectNSetNode, XmlXvmGetObjectString, XmlXvmGetObjectBoolean |
Name | XmlXvmGetObjectString | |||
---|---|---|---|---|
Interface | XSLTVM | |||
Purpose | Get string from XPath object | |||
Prototype | oratext *XmlXvmGetObjectString(xvmobj *obj); | |||
Arguments |
| |||
Returns | (oratext *) string | |||
Description | Get string from XPath object
| |||
Example | obj = XmlXvmEvaluateXPath(vm, code, 1, 1, node); switch (XmlXvmGetObjectType(obj)) case XMLXVM_TYPE_STR: str = XmlXvmGetObjectString(obj); ... | |||
See Also | XmlXvmGetObjectType, XmlXvmGetObjectNSetNum, XmlXvmGetObjectNSetNode, XmlXvmGetObjectNumber, XmlXvmGetObjectBoolean |
Name | XmlXvmGetObjectType | |||
---|---|---|---|---|
Interface | XSLTVM | |||
Purpose | Get XPath object type | |||
Prototype | xmlxvmobjtype XmlXvmGetObjectType(xvmobj *obj); | |||
Arguments |
| |||
Returns | (xmlxvmobjtype) type-code for object | |||
Description | Get XPath object type
| |||
Example | switch (XmlXvmGetObjectType(obj)) case XMLXVM_TYPE_NDSET: ... case XMLXVM_TYPE_BOOL: ... case XMLXVM_TYPE_NUM: ... case XMLXVM_TYPE_FRAG: ... case XMLXVM_TYPE_STR: ... | |||
See Also | XmlXvmGetObjectNSetNum, XmlXvmGetObjectNSetNode, XmlXvmGetObjectString, XmlXvmGetObjectNumber, XmlXvmGetObjectBoolean |
Name | XmlXvmGetOutputDom | |||
---|---|---|---|---|
Interface | XSLTVM | |||
Purpose | Returns the output DOM | |||
Prototype | xmlfragnode *XmlXvmGetOutputDom(xmlxvm *vm); | |||
Arguments |
| |||
Returns | (xmlfragnode *) output DOM, or NULL in a case of SAX or Stream output. | |||
Description | Returns the root node of the result DOM tree (if any).
XmlXvmSetOutputDom() has to be used before transformation to set
the VM to output a DOM tree (the default VM output is a stream).
| |||
Example | doc = XmlCreateDocument(xctx, NULL, NULL, NULL, &err); err = XmlXvmSetOutputDom(vm, doc); err = XmlXvmTransformFile(vm, ...); root = XmlXvmGetOutputDom(vm); | |||
See Also | XmlXvmSetOutputDom |
Name | XmlXvmResetParams | |||
---|---|---|---|---|
Interface | XSLTVM | |||
Purpose | Resets the stylesheet top-level text params. | |||
Prototype | void XmlXvmResetParams(xmlxvm *vm); | |||
Arguments |
| |||
Returns | No returns. | |||
Description | Resets the stylesheet top-level param with their default values.
|
Name | XmlXvmSetBaseURI | ||||||
---|---|---|---|---|---|---|---|
Interface | XSLTVM | ||||||
Purpose | Sets the base URI for the XSLTVM | ||||||
Prototype | xmlerr XmlXvmSetBaseURI(xmlxvm *vm, oratext *baseuri); | ||||||
Arguments |
| ||||||
Returns | (xmlerr) error code. | ||||||
Description | Sets the base URI for the XSLTVM. The baseuri is used by VM to
the compose the path XML documents to be loaded for transformation
using document() or XmlXvmTransformFile().
| ||||||
Example | err = XmlXvmSetBaseURI(vm, "/doc/myxmlfiles/"); err = XmlXvmTransformFile(vm, "xmlfile1", NULL); err = XmlXvmTransformFile(vm, "xmlfile2", NULL); ... |
Name | XmlXvmSetBytecodeBuffer | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Interface | XSLTVM | |||||||||
Purpose | Set the compiled byte-code | |||||||||
Prototype | xmlerr XmlXvmSetBytecodeBuffer(xmlxvm *vm, ub2 *buffer, size_t buflen); | |||||||||
Arguments |
| |||||||||
Returns | (xmlerr) numeric error code, XMLERR_OK [0] on success | |||||||||
Description | Set the compiled bytecode from buffer. Any previously set bytecode
is replaced. An XML transformation can't be performed if the stylesheet
bytecode is not set. The VM doesn't copy the bytecode into internal
buffer, hence the it shouldn't be freed before VM finishes using it.
| |||||||||
Example | code = XmlXvmCompileFile(comp, xslFile, baseuri, flags, &err); len = XmlXvmGetBytecodeLength(code, &err); err = XmlXvmSetBytecodeBuffer(vm, code, len); | |||||||||
See Also | XmlXvmSetBytecodeFile, XmlXvmSetBytecodeURI |
Name | XmlXvmSetBytecodeFile | ||||||
---|---|---|---|---|---|---|---|
Interface | XSLTVM | ||||||
Purpose | Set the compiled bytecode from file | ||||||
Prototype | xmlerr XmlXvmSetBytecodeFile(xmlxvm *vm, oratext *path); | ||||||
Arguments |
| ||||||
Returns | (xmlerr) numeric error code, XMLERR_OK [0] on success | ||||||
Description | Set the compiled bytecode from file. Any previously set bytecode
is replaced. An XML transformation can't be performed if the stylesheet
bytecode is not set.
| ||||||
Example | err = XmlXvmSetBytecodeFile(vm, codefile); err = XmlXvmTransformFile (vm, xmlFile, baseuri); | ||||||
See Also | XmlXvmSetBytecodeURI, XmlXvmSetBytecodeBuffer |
Name | XmlXvmSetBytecodeURI | ||||||
---|---|---|---|---|---|---|---|
Interface | XSLTVM | ||||||
Purpose | Set the compiled byte-code | ||||||
Prototype | xmlerr XmlXvmSetBytecodeURI(xmlxvm *vm, oratext *uri); | ||||||
Arguments |
| ||||||
Returns | (xmlerr) numeric error code, XMLERR_OK [0] on success | ||||||
Description | Set the compiled bytecode from URI. Any previously set bytecode
is replaced. An XML transformation can't be performed if the stylesheet
bytecode is not set.
| ||||||
See Also | XmlXvmSetBytecodeFile, XmlXvmSetBytecodeBuffer |
Name | XmlXvmSetDebugFunc | ||||||
---|---|---|---|---|---|---|---|
Interface | XSLTVM | ||||||
Purpose | Set a callback function for debuging | ||||||
Prototype | #define XMLXVM_DEBUG_FUNC(func) \ void func (ub2 line, oratext *filename, xvmobj *obj, ub4 n) xmlerr XmlXvmSetDebugFunc(xmlxvm *vm, XMLXVM_DEBUG_FUNC(debugcallback)); | ||||||
Arguments |
| ||||||
Returns | (xmlerr) numeric error code, XMLERR_OK [0] on success | ||||||
Description | The user callback function is invoked by VM every time the execution
reaches a new line in the XSLT stylesheet. The VM passes to the user
the stylesheet file name, the line number, the current context nodes-set
and the current node index in the node-set.
IMPORTANT - the stylesheet has to be compiled with flag XMLXVM_DEBUG.
| ||||||
Example | XMLXVM_DEBUG_F(MyCallbackFunction, line, file, obj, n); ... code = XmlXvmCompileFile(comp, xslFile, NULL, XMLXVM_DEBUG, &err); ... vm = XmlXvmCreate(xctx, NULL); len = XmlXvmGetBytecodeLength(code, &err); err = XmlXvmSetBytecodeBuffer(vm, code, len); err = XmlXvmSetDebugFunc(vm, MyCallbackFunction); err = XmlXvmTransformFile(vm, xmlFile, baseuri); |
Name | XmlXvmSetOutputDom | ||||||
---|---|---|---|---|---|---|---|
Interface | XSLTVM | ||||||
Purpose | Sets the XSLTVM to output document node. | ||||||
Prototype | xmlerr XmlXvmSetOutputDom(xmlxvm *vm, xmldocnode *doc); | ||||||
Arguments |
| ||||||
Returns | (xmlerr) error code | ||||||
Description | Sets the XSLTVM to output DOM. If (xmldocnode == NULL) then the
result DOM tree belongs to the VM object and is deleted when
a new transformation is performed or when the VM object is deleted.
If the result DOM tree is to be used for longer period of time then
an xmldocnode has to be created and set to the VM object.
| ||||||
Example | doc = XmlCreateDocument(xctx, NULL, NULL, NULL, &err); err = XmlXvmSetOutputDom(vm, doc); err = XmlXvmTransformFile(vm, ...); root = XmlXvmGetOutputDom(vm); |
Name | XmlXvmSetOutputEncoding | ||||||
---|---|---|---|---|---|---|---|
Interface | XSLTVM | ||||||
Purpose | Sets the encoding for the XSLTVM output | ||||||
Prototype | xmlerr XmlXvmSetOutputEncoding(xmlxvm *vm, oratext *encoding); | ||||||
Arguments |
| ||||||
Returns | (xmlerr) error code. | ||||||
Description | Sets the encoding for the XSLTVM stream output. If the input (data)
encoding is different from the one set by this APIs then encoding
conversion is performed. This APIs overrides the encoding set in the
XSLT stylesheet (if any).
|
Name | XmlXvmSetOutputSax | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Interface | XSLTVM | |||||||||
Purpose | Set XSLTVM to output SAX | |||||||||
Prototype | xmlerr XmlXvmSetOutputSax(xmlxvm *vm, xmlsaxcb *saxcb, void *saxctx); | |||||||||
Arguments |
| |||||||||
Returns | (xmlerr) error code | |||||||||
Description | Set XSLTVM to output SAX. If the SAX callback interface object is
provided the VM outputs the result document in a form of SAX events
using the user specified callback functions.
|
Name | XmlXvmSetOutputStream | ||||||
---|---|---|---|---|---|---|---|
Interface | XSLTVM | ||||||
Purpose | Set the XSLTVM output to a user-defined stream | ||||||
Prototype | xmlerr XmlXvmSetOutputStream(xmlxvm *vm, xmlostream *ostream); | ||||||
Arguments |
| ||||||
Returns | (xmlerr) error code. | ||||||
Description | Set the XSLTVM output to a user-defined stream. The default XSLTVM
output is a stream. This APIs overrides the default stream with
user spesified APIs for writing.
|
Name | XmlXvmSetTextParam | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Interface | XSLTVM | |||||||||
Purpose | Set the stylesheet top-level text param. | |||||||||
Prototype | xmlerr XmlXvmSetTextParam(xmlxvm *vm, oratext *name, oratext *value); | |||||||||
Arguments |
| |||||||||
Returns | (xmlerr) error code, XMLERR_SUCC [0] on success. | |||||||||
Description | Set the stylesheet top-level text param. The param value set in the
XSLT stylesheet is overritten. Since the top-level param are reset
with stylesheed values after each transformation this APIs has to be
called again.
|
Name | XmlXvmTransformBuffer | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Interface | XSLTVM | ||||||||||||
Purpose | Run compiled XSLT stylesheet on XML document in memory | ||||||||||||
Prototype | xmlerr XmlXvmTransformBuffer(xmlxvm *vm, oratext *buffer, ub4 length, oratext *baseURI); | ||||||||||||
Arguments |
| ||||||||||||
Returns | (xmlerr) error code. | ||||||||||||
Description | Run compiled XSLT stylesheet on XML document in memory. The
compiled XSLT stylesheet (bytecode) should be set using
XmlXvmSetBytecode...() prior to this call. xsl:output is supported
only if the output is a stream instead of DOM or SAX.
| ||||||||||||
See Also | XmlXvmTransformFile, XmlXvmTransformURI, XmlXvmTransformDom |
Name | XmlXvmTransformDom | ||||||
---|---|---|---|---|---|---|---|
Interface | XSLTVM | ||||||
Purpose | Run compiled XSLT stylesheet on XML document as DOM | ||||||
Prototype | xmlerr XmlXvmTransformDom(xmlxvm *vm, xmldocnode *root); | ||||||
Arguments |
| ||||||
Returns | (xmlerr) error code. | ||||||
Description | Run compiled XSLT stylesheet on XML document as DOM. The compiled
XSLT stylesheet (bytecode) should be set using XmlXvmSetBytecode...()
prior to this call. xsl:output is supported only if the output is
a stream instead of DOM or SAX.
| ||||||
Example | code = XmlXvmCompileFile(comp, xslFile, baseuri, 0, &err); vm = XmlXvmCreate(xctx, NULL); len = XmlXvmGetBytecodeLength(code, &err); err = XmlXvmSetBytecodeBuffer (vm, code, len); domdoc = XmlLoadDom(xctx, &err, "uri", xmlFile, NULL); err = XmlXvmTransformDom(vm, domdoc); err = XmlXvmTransformDom (vm, domdoc); | ||||||
See Also | XmlXvmTransformFile, XmlXvmTransformURI, XmlXvmTransformBuffer |
Name | XmlXvmTransformFile | ||||||
---|---|---|---|---|---|---|---|
Interface | XSLTVM | ||||||
Purpose | Run compiled XSLT stylesheet on XML document in file | ||||||
Prototype | xmlerr XmlXvmTransformFile(xmlxvm *vm, oratext *path, oratext *baseURI); | ||||||
Arguments |
| ||||||
Returns | (xmlerr) error code | ||||||
Description | Run compiled XSLT stylesheet on XML document in file. The compiled
XSLT stylesheet (bytecode) should be set using XmlXvmSetBytecode ...()
prior to this call. xsl:output is supported only if the output is
a stream instead of DOM or SAX.
| ||||||
Example | code = XmlXvmCompileFile(comp, xslFile, baseuri, 0, &err); ... vm = XmlXvmCreate(xctx, NULL); len = XmlXvmGetBytecodeLength(code, &err); err = XmlXvmSetBytecodeBuffer(vm, code, len); err = XmlXvmTransformFile(vm, xmlFile[i], baseuri); | ||||||
See Also | XmlXvmTransformURI, XmlXvmTransformBuffer, XmlXvmTransformDom |
Name | XmlXvmTransformURI | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Interface | XSLTVM | |||||||||
Purpose | Run compiled XSLT stylesheet on XML document from URI | |||||||||
Prototype | xmlerr XmlXvmTransformURI(xmlxvm *vm, oratext *uri); | |||||||||
Arguments |
| |||||||||
Returns | (xmlerr) error code. | |||||||||
Description | Run compiled XSLT stylesheet on XML document from URI. The compiled
XSLT stylesheet (bytecode) should be set using XmlXvmSetBytecode ...()
prior to this call. xsl:output is supported only if the output is
a stream instead of DOM or SAX.
| |||||||||
See Also | XmlXvmTransformFile, XmlXvmTransformBuffer, XmlXvmTransformDom |