Re: [xsl] Order of processing templates

Subject: Re: [xsl] Order of processing templates
From: Mike Brown <mike@xxxxxxxxxxxxxxxx>
Date: Fri, 21 Feb 2003 02:14:03 -0700 (MST)
Karl Stubsjoen wrote:
> How does one *best* control the flow/process by which templates are
> followed?  I assumed that it would be a top to bottom processing mechanism,
> but it does not necessarily seem so.

Processing starts at the root node of the source tree. The best matching
template for that node is found and instantiated. The end.

Any template might contain an xsl:apply-templates or xsl:for-each instruction
that directs the processor to select more nodes for processing. In the case of
xsl:apply-templates, the best matching template for each of those nodes is
found and instantiated. In the case of xsl:for-each, the best matching 
template is considered to be in the content of the xsl:for-each element.

So you control the processing order via the use of xsl:apply-templates and
xsl:for-each instructions. The match attribute of a template merely declares
that this template matches nodes of a certain pattern.

There are built-in templates for each type of node, if you don't override them 
with your own.

Mike

-- 
  Mike J. Brown   |  http://skew.org/~mike/resume/
  Denver, CO, USA |  http://skew.org/xml/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread