4Suite™ API Documentation

# ► Module Ft.Xml.Xslt.BuiltInExtElements

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

Classes: AssignElement, ChainToElement, CreateIndexElement, DumpKeysElement, DumpVarsElement, FtApplyImports, FtApplyTemplates, FtOutputElement, MsgControlElement, RawTextOutputElement, ReplaceElement, UriToElementElement |  |  |  | Fields: ExtElements, ExtNamespaces, RESERVED_NAMESPACE

## Classes

class AssignElement(Ft.Xml.Xslt.StylesheetTree.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)

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

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

### Fields

class ChainToElement(Ft.Xml.Xslt.StylesheetTree.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)

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

content = <Ft.Xml.Xslt.ContentInfo.Rep instance>
legalAttrs = {'href': <Ft.Xml.Xslt.AttributeInfo.UriReferenceAvt instance>}
validator = <Ft.Xml.Xslt.ContentInfo.Validator instance>

### Fields

class CreateIndexElement(Ft.Xml.Xslt.StylesheetTree.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)

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

legalAttrs = {'name': <Ft.Xml.Xslt.AttributeInfo.StringAvt instance>, 'select': <Ft.Xml.Xslt.AttributeInfo.Expression instance>, 'use': <Ft.Xml.Xslt.AttributeInfo.Expression instance>}

### Fields

class DumpKeysElement(Ft.Xml.Xslt.StylesheetTree.XsltElement)

### Methods

instantiate(self, context, processor)

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

legalAttrs = {'force-update': <Ft.Xml.Xslt.AttributeInfo.YesNoAvt instance>, 'raw': <Ft.Xml.Xslt.AttributeInfo.YesNoAvt instance>}

### Fields

class DumpVarsElement(Ft.Xml.Xslt.StylesheetTree.XsltElement)

### Methods

instantiate(self, context, processor)

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

legalAttrs = {'raw': <Ft.Xml.Xslt.AttributeInfo.YesNoAvt instance>}

### Fields

class FtApplyImports(Ft.Xml.Xslt.StylesheetTree.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)
setup(self)

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime

### Fields

category = 0
content = <Ft.Xml.Xslt.ContentInfo.Rep instance>
doesSetup = 1
legalAttrs = {}

### Fields

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

instantiate, setup

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime

### Fields

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

### Fields

class FtOutputElement(Ft.Xml.Xslt.StylesheetTree.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)
instantiate(self, context, processor)

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

content = <Ft.Xml.Xslt.ContentInfo.Rep instance>
Template is the set of text, instructions or result-elements
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>}

### Fields

class MsgControlElement(Ft.Xml.Xslt.StylesheetTree.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)

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

legalAttrs = {'suppress': <Ft.Xml.Xslt.AttributeInfo.YesNoAvt instance>}

### Fields

class RawTextOutputElement(Ft.Xml.Xslt.StylesheetTree.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)

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

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

### Fields

class ReplaceElement(Ft.Xml.Xslt.StylesheetTree.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)

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

legalAttrs = {'string': <Ft.Xml.Xslt.AttributeInfo.StringExpression instance>, 'substring': <Ft.Xml.Xslt.AttributeInfo.StringExpression instance>}

### Fields

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)

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

execute

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltElement

__init__, __str__, appendChild, expandQName, insertChild, parseAVT, parseExpression, parsePattern, processChildren, splitQName

### Methods inherited from class Ft.Xml.Xslt.StylesheetTree.XsltNode

idle, isLastChild, isPseudoNode, pprint, prime, setup

### Fields

content = <Ft.Xml.Xslt.ContentInfo.Rep instance>
Template is the set of text, instructions or result-elements
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>}

### Fields

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', 'message-control'): <class Ft.Xml.Xslt.BuiltInExtElements.MsgControlElement>, ('http://xmlns.4suite.org/ext', 'output'): <class Ft.Xml.Xslt.BuiltInExtElements.FtOutputElement>, ('http://xmlns.4suite.org/ext', 'raw-text-output'): <class Ft.Xml.Xslt.BuiltInExtElements.RawTextOutputElement>, ...}
ExtNamespaces = {'http://xmlns.4suite.org/ext': 'f'}
RESERVED_NAMESPACE = u'http://xmlns.4suite.org/reserved'