RE: the exact algorithm of REC-xslt-19991116

Yes, the specification in the XSLT 1.0 recommendation is both terse (it
doesn't try to be a tutorial) and informal (it doesn't try to be
mathematically precise). Both aspects can be frustrating, though in fact I
think there have been very few cases where the spec has actually been shown
to be ambiguous.

But we are trying in XSLT 2.0 both to make it more readable and to make it
more precise, though it's difficult to achieve both at once.

You will find expanded explanations of the processing model in a number of
XSLT books that are now available, for example my own XSLT Programmer's
Reference (Wrox Press). These don't say anything that can't be deduced from
a careful reading of the specification, but you might find the descriptions
more approachable.

Michael Kay

> -----Original Message-----
> From: Joachim Ziegler [] 
> Sent: 29 May 2002 10:40
> To:
> Subject: the exact algorithm of REC-xslt-19991116
> 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.
> thank you in advance,
> joachim

Received on Friday, 31 May 2002 14:30:52 UTC