4Suite™ API Documentation

# ► Module Ft.Xml.Xslt.BuiltInExtFunctions

4XSLT specific extension functions (i.e. ones that create a node set)

    Copyright 2005 Fourthought, Inc. (USA).
    Detailed license and copyright information: http://4suite.org/COPYRIGHT
    Project home, documentation, distributions: http://4suite.org/

Functions: DocAsString, FtKey, Lookup, Map, SearchRe, SerializeXml, Split |  |  |  | Globals: ExtFunctions, ExtNamespaces

## Functions

DocAsString(context, obj, encoding='UTF-8')
  Retrieves a document, similar to the document() function, but returns the document as an XPath string object rather than as a node-set.

      Security note: if the associated URI resolver allows file: URLs,
      this extension could be used to read arbitrary system files

FtKey(context, qname, keyList, realContextNode=None)
  Query an XSLT key, but allow the user to override the context node for purposes of determining which source document to check. realContextNode is a node set from which the first node is extracted And used as the context node
Lookup(context, name, key)
  f:lookup() queries an index as defined by f:create-index.
Map(context, funcname, *nodesets)
  Apply the function serially over the given node sets. In iteration i, the function is passed N parameters where N is the number of argument node sets. Each parameter is a node set of size 1, whose node is the ith node of the corresponding argument node set. The return value is a node set consisting of a series of result-tree nodes, each of which is a text node whose value is the string value of the result of the ith function invocation. Warning: this function uses the implied ordering of the node set Based on its implementation as a Python list. But in reality There is no reliable ordering of XPath node sets. Therefore this function is not recommended for use with more than one node set parameter.
SearchRe(context, pattern, arg=None)
  Do a regular expression search against the argument (i.e. get all matches)
SerializeXml(context, nodeset, method=None, omitxmldecl=1)
  f:serialize-xml() takes a node set and turns it into a string representing the serialization of the node set, obtained by concatenating the serialization of each node in the node set in document order.

      See also: XPath (not XSLT) extension function f:parse-xml()

Split(context, arg, delim=u' ')
  DEPRECATED. Equivalent to EXSLT's str:split(). Splits a string according to a sub-string and return a node set of elements nodes, each of which is named "Split" and contains the split text For example f:split('A,B,C,') returns a node set of "Split" nodes having text nodes with values "A", "B" and "C" arg - converted to a string, is the string to split up delim - the delimiter upon which to split, defaults to " "

## Globals

ExtFunctions = {('http://xmlns.4suite.org/ext', 'doc-as-string'): <function DocAsString>, ('http://xmlns.4suite.org/ext', 'key'): <function FtKey>, ('http://xmlns.4suite.org/ext', 'lookup'): <function Lookup>, ('http://xmlns.4suite.org/ext', 'map'): <function Map>, ('http://xmlns.4suite.org/ext', 'search-re'): <function SearchRe>, ('http://xmlns.4suite.org/ext', 'serialize-xml'): <function SerializeXml>, ('http://xmlns.4suite.org/ext', 'split'): <function Split>}
ExtNamespaces = {'http://xmlns.4suite.org/ext': 'f'}