| BaH.Libxslt: | Constants | Functions | Types | Modinfo | Source |
Libxslt is the XSLT processor developed for the Gnome project.
This is the BlitzMax implementation of the libxslt library.
XSLT itself is a an XML language to define transformation for XML. Libxslt is based on libxml2
the XML library developed for the Gnome project.
For more information on XSLT, visit the XSLT website.
You need the BaH.Libxml module in order to build applications which use Libxslt.
Here are some key points about libxslt:
Doing an XSLT transformation can be done in a few simple steps:
See the Libxslt Tutorial for an introduction to using the libxslt module.
| Const XSLT_DEFAULT_URL:String | |
| Description | The XSLT "vendor" URL for this processor. |
| Const XSLT_DEFAULT_VENDOR:String | |
| Description | The XSLT "vendor" string for this processor. |
| Const XSLT_NAMESPACE:String | |
| Description | The XSLT specification namespace. |
| Const XSLT_PARSE_OPTIONS:Int | |
| Description | The set of options to pass to an xmlReadxxx when loading files for XSLT consumption. |
| Function xsltCleanupGlobals() | |
| Description | Unregister all global variables set up by the XSLT library. |
| Type TxsltCompMatch | |
| Description | An XSLT CompMatch. |
| Method free() | |
| Description | Free up the memory allocated by all the elements of the CompMatch. |
| Method testCompMatchList:Int(context:TxsltTransformContext, node:TxmlNode) | |
| Returns | 1 if it matches, 0 if it doesn't and -1 in case of failure. |
| Description | Test whether the node matches one of the patterns in the list. |
| Information | Parameters:
|
| Function compilePattern:TxsltCompMatch(pattern:String, doc:TxmlDoc, node:TxmlNode, style:TxsltStylesheet, runtime:TxsltTransformContext) | |
| Returns | The generated pattern list or Null in case of failure. |
| Description | Compile the XSLT pattern and generates a list of precompiled form suitable for fast matching. |
| Information | Parameters:
|
| Type TxsltDocument | |
| Description | An XSLT Document. |
| Method freeDocumentKeys() | |
| Description | Free the keys associated to a document. |
| Function loadDocument:TxsltDocument(context:TxsltTransformContext , uri:String) | |
| Returns | The new TxsltDocument or Null in case of error. |
| Description | Try to load a document (not a stylesheet) within the XSLT transformation context. |
| Information | Parameters:
|
| Function loadStyleDocument:TxsltDocument(style:TxsltStylesheet , uri:String) | |
| Returns | The new TxsltDocument or Null in case of error. |
| Description | Try to load a stylesheet document within the XSLT transformation context. |
| Information | Parameters:
|
| Function newDocument:TxsltDocument(context:TxsltTransformContext, doc:TxmlDoc) | |
| Returns | The new TxsltDocument. |
| Description | Register a new document, apply key computations. |
| Information | Parameters:
|
| Function newStyleDocument:TxsltDocument(style:TxsltStylesheet, doc:TxmlDoc) | |
| Returns | The new TxsltDocument. |
| Description | Register a new document, apply key computations. |
| Information | Parameters:
|
| Type TxsltElemPreComp | |
| Description | An XSLT ElemPreComp. |
| Method getType:Int() | ||||||||||||||||||||||||
| Description | Returns the type of this elemement. | |||||||||||||||||||||||
| Information | The following lists possible types:
| |||||||||||||||||||||||
| Type TxsltTemplate | |
| Description | An XSLT Template. |
| Type TxsltStylesheet | |
| Description | An XSLT Stylesheet. |
| Method addKey:Int(name:String, nameURI:String, match:String, use:String, inst:TxmlNode) | |
| Returns | 0 in case of success, and -1 in case of failure. |
| Description | Add a key definition to the stylesheet. |
| Information | Parameters:
|
| Method addTemplate:Int(cur:TxsltTemplate, mode:String, modeURI:String) | |
| Returns | -1 in case of error, 0 otherwise. |
| Description | Register the XSLT pattern associated to cur. |
| Information | Parameters:
|
| Method allocateExtra:Int() | |
| Returns | The number of the slot. |
| Description | Allocate an extra runtime information slot statically while compiling the stylesheet and return its number. |
| Method applyStylesheet:TxmlDoc(doc:TxmlDoc) | |
| Returns | The result document or Null in case of error. |
| Description | Apply the stylesheet to the document. |
| Information | NOTE: This may lead to a non-wellformed output, XML wise !
Parameters:
|
| Method cleanupTemplates() | |
| Description | Cleanup the state of the templates used by the stylesheet and the ones it imports. |
| Method compileAttr(attr:TxmlAttribute) | |
| Description | Precompile an attribute in a stylesheet. |
| Information | Basically it checks if it is an attrubute value template, and if yes establish
some structures needed to process it at transformation time.
Parameters:
|
| Method documentComp:TxsltElemPreComp(inst:TxmlNode) | |
| Returns | A precompiled data structure for the element. |
| Description | Pre process an XSLT-1.1 document element. |
| Information | Parameters:
|
| Method free() | |
| Description | Free up the memory allocated to the sheet. |
| Method freeAttributeSetsHashes() | |
| Description | Free up the memory used by attribute sets. |
| Method freeKeys() | |
| Description | Free up the memory used by XSLT keys in the stylesheet. |
| Method freeNamespaceAliasHashes() | |
| Description | Free up the memory used by namespaces aliases. |
| Method freeStyleDocuments() | |
| Description | Free up all the space used by the loaded documents. |
| Method freeStylePreComps() | |
| Description | Free up the memory allocated by all precomputed blocks. |
| Method freeTemplateHashes() | |
| Description | Free up the memory used by addTemplate / getTemplate mechanism. |
| Method namespaceAlias(node:TxmlNode) | |
| Description | Read the stylesheet-prefix and result-prefix attributes, register them as well as the corresponding namespace. |
| Information | Parameters:
|
| Method nextImport:TxsltStylesheet() | |
| Returns | The next stylesheet or Null if it was the last one. |
| Description | Find the next stylesheet in import precedence. |
| Method parseStylesheetAttributeSet(node:TxmlNode) | |
| Description | Parse an XSLT stylesheet attribute-set element. |
| Information | Parameters:
|
| Method parseStylesheetImport:Int(node:TxmlNode) | |
| Returns | 0 in case of success -1 in case of failure. |
| Description | Parse an XSLT stylesheet import element. |
| Information | Parameters:
|
| Method parseStylesheetInclude:Int(node:TxmlNode) | |
| Returns | 0 in case of success -1 in case of failure. |
| Description | Parse an XSLT stylesheet include element. |
| Information | Parameters:
|
| Method parseStylesheetOutput(node:TxmlNode) | |
| Description | Parse an XSLT stylesheet output element and record information related to the stylesheet output. |
| Information | Parameters:
|
| Method parseStylesheetProcess:TxsltStylesheet(doc:TxmlDoc) | |
| Returns | the value of the 'ret' parameter if everything went right, Null if something went amiss. |
| Description | Parse the XSLT stylesheet adding the associated structures. |
| Information | Parameters:
|
| Method parseTemplateContent(templ:TxmlNode) | |
| Description | parse a template content-model Clean-up the template content from unwanted ignorable blank nodes and process xslt:text. |
| Information | Parameters:
|
| Method resolveStylesheetAttributeSet() | |
| Description | Resolve the references between attribute sets. |
| Method saveResultToFilename:Int(url:String, res:TxmlDoc, compression:Int = 0) | |
| Returns | The number of byte written or -1 in case of failure. |
| Description | Save the result res obtained by applying the stylesheet to a URL / filename. |
| Information | Parameters:
|
| Method stylePreCompute(inst:TxmlNode) | |
| Description | Precompute an XSLT stylesheet element. |
| Information | Parameters:
|
| Function newStylesheet:TxsltStylesheet() | |
| Returns | The new TxsltStylesheet or Null in case of error. |
| Description | Create a new XSLT Stylesheet. |
| Function parseStylesheetDoc:TxsltStylesheet(doc:TxmlDoc) | |
| Returns | A new XSLT stylesheet structure. |
| Description | Parse an XSLT stylesheet building the associated structures. |
| Information | Parameters:
|
| Function parseStylesheetFile:TxsltStylesheet(filename:String) | |
| Returns | A new XSLT stylesheet structure. |
| Description | Load and parse an XSLT stylesheet. |
| Information | Parameters:
|
| Type TxsltTransformContext | |
| Description | An XSLT transformation context. |
| Method allocateExtraCtxt:Int() | |
| Returns | the number of the slot. |
| Description | Allocate an extra runtime information slot at run-time and return its number. |
| Information | This makes sure there is a slot ready in the transformation context. |
| Method applyStripSpaces(node:TxmlNode) | |
| Description | Strip the unwanted ignorable spaces from the input tree. |
| Information | Parameters:
|
| Method attrListTemplateProcess:TxmlAttribute(target:TxmlNode, cur:TxmlAttribute) | |
| Returns | A new TxmlAttribute object, or Null in case of error. |
| Description | Do a copy of an attribute list with attribute template processing. |
| Information | Parameters:
|
| Method attrTemplateProcess:TxmlAttribute(target:TxmlNode, cur:TxmlAttribute) | |
| Returns | The attribute replacement. |
| Description | Process the given attribute and return the new processed copy. |
| Information | Parameters:
|
| Method attrTemplateValueProcess:String(value:String) | |
| Returns | The computed string value or Null. |
| Description | Process the given node and return the new string value. |
| Information | Parameters:
|
| Method attrTemplateValueProcessNode:String(value:String, node:TxmlNode) | |
| Returns | The computed string value or Null. |
| Description | Process the given string, allowing to pass a namespace mapping context and return the new string value. |
| Information | Parameters:
|
| Method createRVT:TxmlDoc() | |
| Returns | The result value tree or Null in case of error. |
| Description | Create a result value tree. |
| Method evalAttrValueTemplate:String(node:TxmlNode, name:String, namespace:String) | |
| Returns | The computed string value or Null. |
| Description | Evaluate a attribute value template. |
| Information | i.e. the attribute value can contain expressions contained in curly braces ({}) and those
are substituted by they computed value.
Parameters:
|
| Method evalAVT:String(avt:String, node:TxmlNode) | |
| Returns | The computed string value or Null. |
| Description | Process the given AVT, and return the new string value. |
| Information | Parameters:
|
| Method evalStaticAttrValueTemplate:String(node:TxmlNode, name:String, namespace:String) | |
| Returns | The static string value or Null. |
| Description | Check if an attribute value template has a static value. |
| Information | i.e. the attribute value does not contain expressions contained in curly braces ({})
Parameters:
|
| Method evalTemplateString:String(node:TxmlNode, parent:TxmlNode) | |
| Returns | The computed string value or Null. |
| Description | Evaluate a template string value. |
| Information | i.e. the parent list is interpreter as template content and the resulting tree string value is
returned. This is needed for example by xsl:comment and xsl:processing-instruction.
Parameters:
|
| Method evalXPathString:String(comp:TxmlXPathCompExpr) | |
| Returns | The computed string value or Null. |
| Description | Process the expression using XPath and get a string. |
| Information | Parameters:
|
| Method findDocument:TxsltDocument(doc:TxmlDoc) | |
| Returns | The desired xsltDocument or Null in case of error. |
| Description | Try to find a document within the XSLT transformation context. |
| Information | Parameters:
|
| Method findElemSpaceHandling:Int(node:TxmlNode) | |
| Returns | 1 if space should be stripped, 0 if not, and 2 if everything should be CDTATA wrapped. |
| Description | Find strip-space or preserve-space informations for an element respect the import precedence or the wildcards. |
| Information | Parameters:
|
| Method findTemplate:TxsltTemplate(name:String, nameURI:String) | |
| Returns | The TxsltTemplate or Null if not found. |
| Description | Finds the named template, apply import precedence rule. |
| Information | Parameters:
|
| Method freeDocuments() | |
| Description | Free up all the space used by the loaded documents. |
| Method freeRVTs() | |
| Description | Free all the registered result value tree of the transformation. |
| Method getKey:TxmlNodeSet(name:String, nameURI:String, value:String) | |
| Returns | The nodeset resulting from the query or Null. |
| Description | Lookup a key. |
| Information | Parameters:
|
| Method getNamespace:TxmlNs(curNode:TxmlNode, namespace:TxmlNs, out:TxmlNode) | |
| Returns | The namespace node to use or Null. |
| Description | Find the right namespace value for this prefix. |
| Information | If needed create and add a new namespace decalaration on the node Handle namespace aliases.
Parameters:
|
| Method getPlainNamespace:TxmlNs(curNode:TxmlNode, namespace:TxmlNs, out:TxmlNode) | |
| Returns | The namespace node to use or Null. |
| Description | Find the right namespace value for this prefix. |
| Information | If needed create and add a new namespace decalaration on the node Handle namespace
aliases and make sure the prefix is not NULL, this is needed for attributes.
Parameters:
|
| Method getSpecialNamespace:TxmlNs(curNode:TxmlNode, uri:String, prefix:String, out:TxmlNode) | |
| Returns | The namespace node to use or Null. |
| Description | Find the right namespace value for this URI. |
| Information | If needed create and add a new namespace decalaration on the node.
Parameters:
|
| Method getTemplate:TxsltTemplate(node:TxmlNode, style:TxsltStylesheet) | |
| Returns | The xslt Template or Null if not found. |
| Description | Finds the template applying to this node. |
| Information | If style is non-Null it means one needs to look for the next imported template in scope.
Parameters:
|
| Method initKeys(doc:TxsltDocument) | |
| Description | Computes all the keys tables for the current input document. |
| Information | Should be done before global varibales are initialized.
Parameters:
|
| Method needElemSpaceHandling:Int() | |
| Returns | 1 if space should be stripped, 0 if not. |
| Description | Checks whether that stylesheet requires white-space stripping. |
| Method registerPersistRVT:Int(rvt:TxmlDoc) | |
| Returns | 0 in case of success and -1 in case of error. |
| Description | Register the result value tree for destruction at the end of the processing. |
| Information | Parameters:
|
| Method registerTmpRVT:Int(rvt:TxmlDoc) | |
| Returns | 0 in case of success and -1 in case of error. |
| Description | Register the result value tree for destruction at the end of the context. |
| Information | Parameters:
|
| Method templateProcess:TxmlNode(node:TxmlNode) | |
| Returns | The computed tree replacement. |
| Description | Process the given node and return the new string value. |
| Function newTransformContext:TxsltTransformContext(stylesheet:TxsltStylesheet, doc:TxmlDoc) | |
| Returns | The new xsltTransformContext or Null in case of error. |
| Description | Create a new XSLT TransformContext. |
| Information | Parameters:
|
| Version | 1.01 |
|---|---|
| License | MIT |
| Author | Daniel Veillard |
| Credit | Adapted for BlitzMax by Bruce A Henderson |
| Modserver | BRL |
| History | 1.01 |
| History | Updated to Libxslt 1.1.20 |
| History | 1.00 Initial Release (Libxslt 1.1.16) |