EXSLT - dyn:closure - Implementer Page

Version: 1
Status: new
User Page: index.html
XML Definition: dyn.closure.xml
Function Package: dyn.closure.zip

Function Syntax

node-set dyn:closure(node-set, string)

The dyn:closure function creates a node set resulting from transitive closure of evaluating the expression passed as the second argument on each of the nodes passed as the first argument, then on the node set resulting from that and so on until no more nodes are found. For example:

dyn:closure(., '*')

returns all the descendant elements of the node (its element children, their children, their children's children and so on).

The expression is thus evaluated several times, each with a different node set acting as the context of the expression. The first time the expression is evaluated, the context node set is the first argument passed to the dyn:closure function. In other words, the node set for each node is calculated by evaluating the XPath expression with all context information being the same as that for the call to the dyn:closure function itself, except for the following:

  • the context node is the node whose value is being calculated
  • the context position is the position of the node within the node set passed as the first argument to the dyn:closure function, arranged in document order
  • the context size is the number of nodes passed as the first argument to the dyn:closure function
  • the current node is the node whose value is being calculated

The result for a particular iteration is the union of the node sets resulting from evaluting the expression for each of the nodes in the source node set for that iteration. This result is then used as the source node set for the next iteration, and so on. The result of the function as a whole is the union of the node sets generated by each iteration.

If the expression string passed as the second argument is an invalid XPath expression (including an empty string) or an expression that does not return a node set, this function returns an empty node set.

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


No XSLT processors that we know of have built-in support for dyn:closure.

There are currently no third-party implementations of dyn:closure.

Change History

Submitted: 2001-11-25
Creator: Christian Nentwich

Returns a node set containing the results of evaluating an XPath expression on each of a set of nodes, and then on the resulting node set, until no new nodes are found.

http://www.exslt.org/dyn/functions/closure/dyn.closure.html last modified 2001-11-25