4Suite API Documentation

Module Ft.Xml.Xslt.BuiltInExtElements

Fourthought proprietary XSLT extension elements
Copyright 2006 Fourthought, Inc. (USA).
Detailed license and copyright information: http://4suite.org/COPYRIGHT
Project home, documentation, distributions: http://4suite.org/
Classes:
Globals:

Classes

class AssignElement(Ft.Xml.Xslt.cStylesheetTree.XsltElement)
The f:assign element works like xsl:variable, but forces both a local and a global variable binding, replacing any other in-scope bindings having the same expanded-name. Thus, it can be used to circumvent XSLT's restriction on variables not being reassignable. However, its use is not recommended, for reasons explained below.
As with xsl:variable, the name of the variable is given in the mandatory
name attribute, and the new value may be given either by an expression in
the select attribute, or by instantiating the content of the element.

If no select attribute is given, then a body-as-ns attribute may be used
to indicate whether to assign the variable to the contents as a node-set
(value 'yes') or as a result tree fragment (default, or value 'no').
In either case, be aware that the node-set or result tree fragment will
have a root node.

Note that reassignment of variables is generally never actually needed.
Before using f:assign, read the XSL FAQ or ask on xsl-list if there is a
better, more portable way to solve your problem.

XSLT is designed as a language that is free of side-effects, which is
why assignment is not allowed and variables have very specific scope.
When variable assignment is allowed, certain optimizations in the XSLT
processor become impossible. Also, there are some circumstances in which
the order of execution may not be quite what you expect, in which case
f:assign may show anomalous behavior. It does not work predictably when
called from within a tail-recursive template, for example.

That said, f:assign can be a convenient way to create a node-set from
a result tree fragment in XSLT 1.0. The proper way to do this is with
EXSLT: <xsl:variable name="rtf"><foo/></xsl:variable>
<xsl:variable name="ns" select="exsl:node-set($rtf)" xmlns:exsl="http://exslt.org/common"/>
but f:assign can do it in one step:
<f:assign name="ns" body-as-ns="yes"><foo/></f:assign>

Methods

instantiate(self, context, processor)
Overrides: instantiate from class XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Methods inherited from class object

__delattr__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __str__

Members

__dict__ = <attribute '__dict__' of 'AssignElement' objects>
__weakref__ = <attribute '__weakref__' of 'AssignElement' objects>
legalAttrs = {'body-as-ns': <Ft.Xml.Xslt.AttributeInfo.YesNoAvt instance>, 'name': <Ft.Xml.Xslt.AttributeInfo.QName instance>, 'select': <Ft.Xml.Xslt.AttributeInfo.Expression instance>}

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Members inherited from class object

__class__
class ChainToElement(Ft.Xml.Xslt.cStylesheetTree.XsltElement)
f:chain-to tells the processor to apply the output of the current stylsheet as the input of another stylesheet, establishing a chain of transforms. The next stylesheet in the chain is specified using an AVT, which allows for dynamically constructed chains.
Children can be xsl:with-param elements, in which case the specified
values are passed on to the next stylesheet as top-level parameters

Warning: if the href attribute is blank, it will chain back to this
same stylesheet and could lead to an infinite loop.
FIXME: Trap this condition

Methods

instantiate(self, context, processor)
Overrides: instantiate from class XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Methods inherited from class object

__delattr__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __str__

Members

__dict__ = <attribute '__dict__' of 'ChainToElement' objects>
__weakref__ = <attribute '__weakref__' of 'ChainToElement' objects>
content = <ContentModel object>
legalAttrs = {'href': <Ft.Xml.Xslt.AttributeInfo.UriReferenceAvt instance>}

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Members inherited from class object

__class__
class CreateIndexElement(Ft.Xml.Xslt.cStylesheetTree.XsltElement)
f:create-index allows one to create an arbitrary key at run time using any node data. It is similar to xsl:key, except that it is computed on demand at run-time, and uses an XPath selection rather than an XSLT match, which gives more flexibility over what is indexed.
These keys can be accessed using the extension function f:lookup().

Avoid making a dynamic index have the same name as a proper xsl:key.
In particular this will confuse tools such as the <f:dump-keys/>
diagnostic extension.

Methods

instantiate(self, context, processor)
Overrides: instantiate from class XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Methods inherited from class object

__delattr__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __str__

Members

__dict__ = <attribute '__dict__' of 'CreateIndexElement' objects>
__weakref__ = <attribute '__weakref__' of 'CreateIndexElement' objects>
legalAttrs = {'name': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>, 'select': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, 'use': <Ft.Xml.Xslt.AttributeInfo.Expression instance>}

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Members inherited from class object

__class__
class DumpKeysElement(Ft.Xml.Xslt.cStylesheetTree.XsltElement)

Methods

instantiate(self, context, processor)
Overrides: instantiate from class XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Methods inherited from class object

__delattr__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __str__

Members

__dict__ = <attribute '__dict__' of 'DumpKeysElement' objects>
__weakref__ = <attribute '__weakref__' of 'DumpKeysElement' objects>
legalAttrs = {'force-update': <Ft.Xml.Xslt.AttributeInfo.YesNoAvt instance>, 'raw': <Ft.Xml.Xslt.AttributeInfo.YesNoAvt instance>}

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Members inherited from class object

__class__
class DumpVarsElement(Ft.Xml.Xslt.cStylesheetTree.XsltElement)

Methods

instantiate(self, context, processor)
Overrides: instantiate from class XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Methods inherited from class object

__delattr__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __str__

Members

__dict__ = <attribute '__dict__' of 'DumpVarsElement' objects>
__weakref__ = <attribute '__weakref__' of 'DumpVarsElement' objects>
legalAttrs = {'raw': <Ft.Xml.Xslt.AttributeInfo.YesNoAvt instance>}

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Members inherited from class object

__class__
class EmailElement(Ft.Xml.Xslt.cStylesheetTree.XsltElement)
The `f:email` extension element sends a sequence of email messages. The body of this element is a template; when the template is instantiated, the extension attempts to send one email for each `fr:email` element (where the `fr` prefix is bound to the "http://xmlns.4suite.org/reserved" namespace URI). The `fr:email` element should contain a sequence of `fr:header` elements, which determine the headers of the current email. Each `fr:header` element should have a `name` attribute, which specifies the name of the header, and the string value of the `fr:header` element provides the value of the header. The `fr:email` element should also contain a `fr:text` element; the string value of this element is used as the body of the current email. (The implication of this structure is that currently, this extension element only supports sending emails with simple, textual content, although that could easily change in future versions of this extension.)
This extension takes one optional attribute, named `server`, which
specifies the SMTP server to use to send all the emails found in the
body of the current extension element.  If not specified, it defaults to
"localhost".

The XML result of this element is a sequence of result reports.  There
will be one result report for each `fr:email` element found.  A success
report indicates that the email was sent to at least one recipient, and
has the following form::

  <result xmlns="http://xmlns.4suite.org/reserved">
    <command>
      <email/>
    </command>
    <success/>
  </result>

A failure report indicates that something happened that prevented the
email from being sent to any of its recipients, and has the following
form:

  <result xmlns="http://xmlns.4suite.org/reserved">
    <command>
      <email/>
    </command>
    <failure>
      <!-- Traceback leading to the failure here -->
    </failure>
  </result>

Methods

instantiate(self, context, processor)
Overrides: instantiate from class XsltElement
send_email(self, email, resultWriter)

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Methods inherited from class object

__delattr__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __str__

Members

__dict__ = <attribute '__dict__' of 'EmailElement' objects>
__weakref__ = <attribute '__weakref__' of 'EmailElement' objects>
content = <ContentModel object>
legalAttrs = {'server': <Ft.Xml.Xslt.AttributeInfo.String instance>}

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Members inherited from class object

__class__
class FtApplyImports(Ft.Xml.Xslt.cStylesheetTree.XsltElement)
The f:apply-imports element is an extension of the xsl:apply-imports element. It differs from xsl:apply-imports in the following way: The element accepts xsl:with-param children that designate parameters that will be passed to the applied templates.

Methods

instantiate(self, context, processor)
Overrides: instantiate from class XsltElement
setup(self)
Overrides: setup from class XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Methods inherited from class object

__delattr__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __str__

Members

__dict__ = <attribute '__dict__' of 'FtApplyImports' objects>
__weakref__ = <attribute '__weakref__' of 'FtApplyImports' objects>
category = 0
content = <ContentModel object>
doesSetup = 1
legalAttrs = {}

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Members inherited from class object

__class__
class FtApplyTemplates(Ft.Xml.Xslt.ApplyTemplatesElement.ApplyTemplatesElement)
The f:apply-templates element is an extension of the xsl:apply-templates element. It differs from xsl:apply-templates in the following way: The value of the mode attribute is an attribute value template rather than a static string. Thus, the mode can be computed at run time.

Methods inherited from class Ft.Xml.Xslt.ApplyTemplatesElement.ApplyTemplatesElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Methods inherited from class object

__delattr__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __str__

Members

legalAttrs = {'mode': <Ft.Xml.Xslt.AttributeInfo.QNameAvt instance>, 'select': <Ft.Xml.Xslt.AttributeInfo.Expression instance>}

Members inherited from class Ft.Xml.Xslt.ApplyTemplatesElement.ApplyTemplatesElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Members inherited from class object

__class__
class FtOutputElement(Ft.Xml.Xslt.cStylesheetTree.XsltElement)
f:output is similar to xsl:output, but it allows you to compute the output parameters dynamically (as attribute value templates). Unlike xsl:output, this element is not expected to be empty; the output parameters apply only to the serialization of the element's content.

Methods

__init__(self, *args, **kwds)
Overrides: __init__ from class XsltElement
instantiate(self, context, processor)
Overrides: instantiate from class XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Methods inherited from class object

__delattr__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __str__

Members

__dict__ = <attribute '__dict__' of 'FtOutputElement' objects>
__weakref__ = <attribute '__weakref__' of 'FtOutputElement' objects>
content = <ContentModel object>
legalAttrs = {'cdata-section-elements': <Ft.Xml.Xslt.AttributeInfo.QNamesAvt instance>, 'doctype-public': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>, 'doctype-system': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>, 'encoding': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>, 'indent': <Ft.Xml.Xslt.AttributeInfo.YesNoAvt instance>, 'media-type': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>, 'method': <Ft.Xml.Xslt.AttributeInfo.QNameAvt instance>, 'omit-xml-declaration': <Ft.Xml.Xslt.AttributeInfo.YesNoAvt instance>, 'standalone': <Ft.Xml.Xslt.AttributeInfo.YesNoAvt instance>, 'version': <Ft.Xml.Xslt.AttributeInfo.NMTokenAvt instance>}

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Members inherited from class object

__class__
class GettextElement(Ft.Xml.Xslt.cStylesheetTree.XsltElement)

Methods

instantiate(self, context, processor)
Overrides: instantiate from class XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Methods inherited from class object

__delattr__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __str__

Members

__dict__ = <attribute '__dict__' of 'GettextElement' objects>
__weakref__ = <attribute '__weakref__' of 'GettextElement' objects>
content = <ContentModel object>

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Members inherited from class object

__class__
class MsgControlElement(Ft.Xml.Xslt.cStylesheetTree.XsltElement)
f:msg-control provides, as a side effect, context-sensitive control over whether messages (i.e., those produced by xsl:message) and warnings are output by the processor.

Methods

instantiate(self, context, processor)
Overrides: instantiate from class XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Methods inherited from class object

__delattr__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __str__

Members

__dict__ = <attribute '__dict__' of 'MsgControlElement' objects>
__weakref__ = <attribute '__weakref__' of 'MsgControlElement' objects>
legalAttrs = {'suppress': <Ft.Xml.Xslt.AttributeInfo.YesNoAvt instance>}

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Members inherited from class object

__class__
class RawTextOutputElement(Ft.Xml.Xslt.cStylesheetTree.XsltElement)
Given a foreign XPath object, f:raw-text-output creates a text node based on the object, just like xsl:value-of with disable-output-escaping="yes". Unlike xsl:value-of, however, this element does not use the string-value of the object; it instead feeds the object directly to the current output writer. Therefore, unless a custom output writer is used, the object must be a Python Unicode string.
The intent is to provide a way to serialize a Unicode string that may
contain characters that are not permitted in an XPath string object.
For example, another extension can convert raw binary data to a
Unicode string, and then this extension can reserialize that string
through the XSLT output stream, without risk of losing any data due
to XPath's restrictions on string content.

Methods

instantiate(self, context, processor)
Overrides: instantiate from class XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Methods inherited from class object

__delattr__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __str__

Members

__dict__ = <attribute '__dict__' of 'RawTextOutputElement' objects>
__weakref__ = <attribute '__weakref__' of 'RawTextOutputElement' objects>
legalAttrs = {'select': <Ft.Xml.Xslt.AttributeInfo.Expression instance>}

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Members inherited from class object

__class__
class ReplaceElement(Ft.Xml.Xslt.cStylesheetTree.XsltElement)
f:replace performs a search and replace on a string, placing the results in the output. The content is treated as a template. The string value of the output from this template is the replacement string. All instances of the string given by the 'substring' attribute are replaced with the replacement string.

Methods

instantiate(self, context, processor)
Overrides: instantiate from class XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Methods inherited from class object

__delattr__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __str__

Members

__dict__ = <attribute '__dict__' of 'ReplaceElement' objects>
__weakref__ = <attribute '__weakref__' of 'ReplaceElement' objects>
legalAttrs = {'string': <Ft.Xml.Xslt.AttributeInfo.StringExpression instance>, 'substring': <Ft.Xml.Xslt.AttributeInfo.StringExpression instance>}

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Members inherited from class object

__class__
class SetupTranslationsElement(Ft.Xml.Xslt.cStylesheetTree.XsltElement)

Methods

prime(self, processor, context)
#def instantiate(self, context, processor):
Overrides: prime from class XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Methods inherited from class object

__delattr__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __str__

Members

__dict__ = <attribute '__dict__' of 'SetupTranslationsElement' objects>
__weakref__ = <attribute '__weakref__' of 'SetupTranslationsElement' objects>
category = 1
doesPrime = 1
legalAttrs = {'domain': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>, 'localedir': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>}

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Members inherited from class object

__class__
class UriToElementElement(Ft.Xml.Xslt.ElementElement.ElementElement)
Extends xsl:element by deriving the constructed element's QName and namespace from the supplied URI reference. The URI reference is first resolved to absolute form. Then, if the resulting URI begins with an in-scope namespace, that namespace will be used as if it had been supplied as the 'namespace' attribute to xsl:element, and the remainder of the URI will be combined with a prefix from the in-scope namespace bindings and used as if supplied as the 'name' attribute to xsl:element.
Otherwise, the supplied default-name and default-namespace will be
used, effecting the same result as calling xsl:element with these
values.

The intent is to allow an RDF resource, as identified by a URI with
a fragment component, to be easily converted into an element.

Methods

instantiate(self, context, processor)
Overrides: instantiate from class ElementElement

Methods inherited from class Ft.Xml.Xslt.ElementElement.ElementElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Methods inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Methods inherited from class object

__delattr__, __getattribute__, __hash__, __reduce_ex__, __setattr__, __str__

Members

content = <ContentModel object>
legalAttrs = {'default-name': <Ft.Xml.Xslt.AttributeInfo.RawQNameAvt instance>, 'default-namespace': <Ft.Xml.Xslt.AttributeInfo.UriReferenceAvt instance>, 'uri': <Ft.Xml.Xslt.AttributeInfo.UriReferenceAvt instance>, 'use-attribute-sets': <Ft.Xml.Xslt.AttributeInfo.QNames instance>}

Members inherited from class Ft.Xml.Xslt.ElementElement.ElementElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltElement

Members inherited from class Ft.Xml.Xslt.cStylesheetTree.XsltNode

Members inherited from class object

__class__

Globals

ExtElements = {('http://xmlns.4suite.org/ext', 'apply-imports'): <class 'Ft.Xml.Xslt.BuiltInExtElements.FtApplyImports'>, ('http://xmlns.4suite.org/ext', 'apply-templates'): <class 'Ft.Xml.Xslt.BuiltInExtElements.FtApplyTemplates'>, ('http://xmlns.4suite.org/ext', 'assign'): <class 'Ft.Xml.Xslt.BuiltInExtElements.AssignElement'>, ('http://xmlns.4suite.org/ext', 'chain-to'): <class 'Ft.Xml.Xslt.BuiltInExtElements.ChainToElement'>, ('http://xmlns.4suite.org/ext', 'create-index'): <class 'Ft.Xml.Xslt.BuiltInExtElements.CreateIndexElement'>, ('http://xmlns.4suite.org/ext', 'dump-keys'): <class 'Ft.Xml.Xslt.BuiltInExtElements.DumpKeysElement'>, ('http://xmlns.4suite.org/ext', 'dump-vars'): <class 'Ft.Xml.Xslt.BuiltInExtElements.DumpVarsElement'>, ('http://xmlns.4suite.org/ext', 'email'): <class 'Ft.Xml.Xslt.BuiltInExtElements.EmailElement'>, ('http://xmlns.4suite.org/ext', 'gettext'): <class 'Ft.Xml.Xslt.BuiltInExtElements.GettextElement'>, ('http://xmlns.4suite.org/ext', 'message-control'): <class 'Ft.Xml.Xslt.BuiltInExtElements.MsgControlElement'>, ...}
ExtNamespaces = {'http://xmlns.4suite.org/ext': 'f'}
RESERVED_NAMESPACE = u'http://xmlns.4suite.org/reserved'