# the exact algorithm of REC-xslt-19991116

From: Joachim Ziegler <ziegler@algorilla.de>
Date: Wed, 29 May 2002 05:40:26 -0400 (EDT)

Message-Id: <200205291136.08870.ziegler@algorilla.de>
```

hello,

as a computer scientist i'm used to think in algorithms, and reading this
XSL-specification i've tried to find out what exactly the transformation
algorithm
does and how it can be parameterized by the various XSL-instructions.
understanding the transformation means understanding this algorithm.

unfortunately you do not give the exact algorithm, you only give a rather
informal description of how it might really work.

the whole description is quite confusing to me. in section 5, you talk about
"the processing model" and a "current node" and a "current node set".

--- cite ----
A list of source nodes is processed to create a result tree fragment. The
result tree is constructed by
processing a list containing just the root node. A list of source
nodes is processed by appending the
result tree structure created by processing each of the members of
the list in order. A node is
processed by finding all the template rules with patterns that match
the node, and choosing the best
amongst them; the chosen rule's template is then instantiated with
the node as the current node and
with the list of source nodes (*) as the current node list. A
template typically contains instructions that
select an additional list of source nodes for processing. The
process of matching, instantiation and
selection is continued recursively until no new source nodes are
selected for processing.
--- cite ---

what exaclty is the "list of source nodes"  in (*)?
what does the instantiated template do with the "current node list"?
what i do not get is how and when these lists are updated and what the
recursion really does and when it happens (only in xsl:apply-template? or
also in xsl:foreach?).
in the description of xsl:apply-template you do not say how it changes what
lists and what recursion exaclty it calls. you only say (quite informally)
"the xsl:apply-templates instruction processes all of the children of the
current node"

can you give me some pseudocode? that would help a lot.