<?xml version="1.0" encoding="utf-8"?>
<exslt:function xmlns:exslt="http://exslt.org/documentation" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:vcf="http://www.ietf.org/internet-drafts/draft-dawson-vcard-xml-dtd-03.txt" version="1" module="dyn" status="new">
   <exslt:name>closure</exslt:name>
   <rdf:Description ID="dyn:closure">
      <dc:subject>EXSLT</dc:subject>
      <dc:subject>dyn</dc:subject>
      <dc:subject>closure</dc:subject>
      <exslt:revision>
         <rdf:Description ID="dyn:closure.1">
            <exslt:version>1</exslt:version>
            <dc:creator rdf:parseType="Resource">
               <vcf:fn>Christian Nentwich</vcf:fn>
               <vcf:email>c.nentwich@cs.ucl.ac.uk</vcf:email>
            </dc:creator>
            <dc:date>2001-11-25</dc:date>
            <dc:description>
               <html:div><!-- if you want to use DocBook, add written-in="docbook" to summary element -->
         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.
      </html:div>
            </dc:description>
         </rdf:Description>
      </exslt:revision>
   </rdf:Description>
   <exslt:doc>
      <html:div><!-- if you want to use DocBook, add written-in="docbook" to documentation element -->
         <html:p>
        The <html:code>dyn:closure</html:code> 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:
      </html:p>
         <html:pre>
dyn:closure(., '*')
</html:pre>
         <html:p>
        returns all the descendant elements of the node (its element children, their children, their children's children and so on).
      </html:p>
         <html:p>
        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 <html:code>dyn:closure</html:code> 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 <html:code>dyn:closure</html:code> function itself, except for the following:
      </html:p>
         <html:ul>
            <html:li>the context node is the node whose value is being calculated</html:li>
            <html:li>the context position is the position of the node within the node set passed as the first argument to the <html:code>dyn:closure</html:code> function, arranged in document order</html:li>
            <html:li>the context size is the number of nodes passed as the first argument to the <html:code>dyn:closure</html:code> function</html:li>
            <html:li>the current node is the node whose value is being calculated</html:li>
         </html:ul>
         <html:p>
        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.
      </html:p>
         <html:p>
        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.
      </html:p>
      </html:div>
   </exslt:doc>
   <exslt:definition>
      <exslt:return type="node-set">
         <html:div/>
      </exslt:return>
      <exslt:arg name="nodes" type="node-set" optional="no">
         <html:div/>
      </exslt:arg>
      <exslt:arg name="expression" type="string" optional="no">
         <html:div/>
      </exslt:arg>
   </exslt:definition>
   <exslt:implementations/>
   <exslt:use-cases/>
</exslt:function>