4Suite API Documentation: Ft.Xml.Xslt.Exslt.Strings

4Suite™ API Documentation

# ► Module Ft.Xml.Xslt.Exslt.Strings

EXSLT - Strings

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

Functions: Align, Concat, DecodeUri, EncodeUri, Padding, Replace, Split, Tokenize |  |  |  | Globals: EXSL_STRINGS_NS, ExtElements, ExtFunctions, ExtNamespaces, NAMESPACE_NODE

## Functions

Align(context, target, padding, alignment='')
  The str:align function aligns a string within another string.

      See http://exslt.org/str/functions/align/str.align.html for further
      explanation.

Concat(context, nodeset)
  The str:concat function takes a node set and returns the concatenation of the string values of the nodes in that node set. If the node set is empty, it returns an empty string.
DecodeUri(context, uri, encoding=u'UTF-8')
  The str:decode-uri function decodes a percent-encoded string, such as one would find in a URI.
EncodeUri(context, uri, escapeReserved, encoding=u'UTF-8')
  The str:encode-uri function percent-encodes a string for embedding in a URI. The second argument is a boolean indicating whether to escape reserved characters; if true, the given string can be a URI already, with just some of its characters needing to be escaped (not recommended, but users who don't understand the nuances of the URI syntax tend to prefer it over assembling a URI piece-by-piece).
Padding(context, length, chars=None)
  The str:padding function creates a padding string of a certain length.

      The second argument gives a string to be used to create the padding.
      This string is repeated as many times as is necessary to create a string
      of the length specified by the first argument; if the string is more than
      a character long, it may have to be truncated to produce the required
      length. If no second argument is specified, it defaults to a space (' ').

Replace(context, s, searchNodes, replNodes)
  The str:replace function converts a string to a node-set, with each instance of a substring from a given list (obtained from the string-values of nodes in the second argument) replaced by the node at the corresponding position of the node-set given as the third argument. Unreplaced substrings become text nodes.

      The second and third arguments can be any type of object; if
      either is not a node-set, it is treated as if it were a node-set
      of just one text node, formed from the object's string-value.

      Attribute and namespace nodes in the replacement set are
      erroneous but are treated as empty text nodes.

      All occurrences of the longest substrings are replaced first,
      and once a replacement is made, that span of the original string
      is no longer eligible for future replacements.

      An empty search string matches between every character of the
      original string.

      See http://exslt.org/str/functions/replace/str.replace.html for details.

Split(context, string, pattern=u' ')
  The str:split function splits up a string and returns a node set of token elements, each containing one token from the string.

      The first argument is the string to be split. The second argument is a
      pattern string (default=' '). The string given by the first argument is
      split at any occurrence of this pattern. An empty string pattern will
      result in a split on every character in the string.

Tokenize(context, string, delimiters='\t\n\r ')
  The str:tokenize function splits up a string and returns a node set of 'token' elements, each containing one token from the string.

      The first argument is the string to be tokenized. The second argument
      is a string consisting of a number of characters. Each character in
      this string is taken as a delimiting character. The string given by the
      first argument is split at any occurrence of any of these characters.

## Globals

EXSL_STRINGS_NS = 'http://exslt.org/strings'
ExtElements = {}
ExtFunctions = {('http://exslt.org/strings', 'align'): <function Align>, ('http://exslt.org/strings', 'concat'): <function Concat>, ('http://exslt.org/strings', 'decode-uri'): <function DecodeUri>, ('http://exslt.org/strings', 'encode-uri'): <function EncodeUri>, ('http://exslt.org/strings', 'padding'): <function Padding>, ('http://exslt.org/strings', 'replace'): <function Replace>, ('http://exslt.org/strings', 'split'): <function Split>, ('http://exslt.org/strings', 'tokenize'): <function Tokenize>}
ExtNamespaces = {'http://exslt.org/strings': 'str'}
NAMESPACE_NODE = 13