EXSLT - dyn:closure

Implementer Page: dyn.closure.html
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.

Implementations

There are currently no XSLT processors that we know of that support dyn:closure natively.

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

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