EXSLT - func:result - Implementer Page

Version: 3
Status: stable
User Page: index.html
XML Definition: func.result.xml
Element Package: func.result.zip

Element Syntax

<func:result
   select = expression>
   <-- Content: template -->
</func:result>

When an func:result element is instantiated, during the instantiation of a func:function element, the function returns with its value. The value of the func:result element is determined in a similar way to variable-binding elements as described in [11.2 Values of Variables and Parameters] of [XSLT].

It is an error for a func:result element to not be a descendant of func:function. It is an error for a func:result element to have any following sibling elements aside from the xsl:fallback element.

It is an error if instantiating the content of the func:function element results in the instantion of more than one func:result elements.

Thus the following is an error if the value of the context node when the function is called is equal to the string 'yes', as two func:result elements are instantiated: one within the xsl:if and one directly within the func:function:

<func:function name="my:func1">
   <xsl:if test=". = 'yes'">
      <func:result select="true()" />
   </xsl:if>
   <func:result select="false()" />
</func:function>

It is an error if a func:result element occurs within an func:result element. Thus the following is an error:

<func:function name="my:func2">
   <func:result>
      <func:result select="." />
   </func:result>
</func:function>

It is an error if instantiating the content of a variable-binding element (i.e. xsl:variable, xsl:param) results in the instantiation of an func:result element. Thus the following is an error:

<func:function name="my:func3">
   <xsl:variable name="foo">
      <func:result select="." />
   </xsl:variable>
</func:function>

Return Values

The func:result element can specify the value of the variable in three alternative ways.

  • If the func:result element has a select attribute, then the value of the attribute must be an expression and the returned value is the object that results from evaluating the expression. In this case, the content must be empty.

  • If the func:result element does not have a select attribute and has non-empty content (i.e. the func:result element has one or more child nodes), then the content of the func:result element specifies the value. The content of the func:result element is a template, which is instantiated to give the returned value. The value is a result tree fragment equivalent to a node-set containing just a single root node having as children the sequence of nodes produced by instantiating the template. The base URI of the nodes in the result tree fragment is the base URI of the func:result element.

    It is an error if a member of the sequence of nodes created by instantiating the template is an attribute node or a namespace node, since a root node cannot have an attribute node or a namespace node as a child. An XSLT processor may signal the error; if it does not signal the error, it must recover by not adding the attribute node or namespace node.

  • If the func:result element has empty content and does not have a select attribute, then the returned value is an empty string. Thus

    <func:result />

    is equivalent to

    <func:result select="''"/>

An implementation of this extension element in the EXSLT func namespace must conform to the behaviour described in this document.

Implementations

Built-in support for func:result is available in the following XSLT processors:

ProcessorProcessor VersionImplemented Version
4XSLT, from 4Suite.0.12.0a33
SAXON 6.3 from Michael Kay6.33
libxslt from Daniel Veillard; implementation by Thomas Broyer1.0.193
Xalan-J from Apache2.4.D13

There are currently no third-party implementations of func:result.

Change History

Previous Version: func.result.2.html

VersionModifiedByDetails
32001-03-31Jeni Tennison
  • Added static constraint such that func:result cannot have any following sibling elements aside from xsl:fallback.
  • Made the instantiation of more than one func:result element an unrecoverable error.
  • Changed the result of a calling a function where no func:result element is instantiated to be an empty string rather than an empty result tree fragment.
3.12001-04-28Jeni Tennison

Added static constraint that forces func:result to be a descendant of func:function.

3.22001-05-22Jeni Tennison
  • Added vendor implementations in Saxon and 4XSLT
  • Changed status to stable
3.32001-08-15Jeni Tennison

Added vendor implementation in libxslt.

3.42002-08-20Craig Stewart

Added Xalan-J implementation to the list.

3.52002-11-12Craig Stewart

Updated 4XSLT version to 0.12.0a3.

Copyright

http://www.exslt.org/func/elements/result/func.result.html last modified 2002-11-12