# EXSLT - func:result

Implementer Page: func.result.html 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="''"/>
## Implementations The following XSLT processors support `func:result`: 4XSLT, from 4Suite. (version 0.12.0a3) SAXON 6.3 from Michael Kay (version 6.3) libxslt from Daniel Veillard; implementation by Thomas Broyer (version 1.0.19) Xalan-J from Apache (version 2.4.D1) There are currently no third-party implementations of `func:result`.

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