This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Identity Transform and Default Templates, I think...


Schneeman, Brent wrote:
> I think that my question boils down to template application - when does a
> particular template get applied? When does the default template get applied?

Source XML document is parsed by an XML parser, its logical contents reported
to the XSLT processor, and the processor models the info as a tree of nodes
according to the XPath/XSLT data model. (It's a very DOM-like model if you're 
familiar with that).

The topmost node (always present) is the root node. The XML source's "document
element" (top/outermost element) is the only child of the root node. From
there, the hierarchy depends on the content of the document.

Processing begins at the root node, always. The best matching template for
that node is found and its contents instantiated. End of processing.

xsl:apply-templates and xsl:for-each instructions typically select new nodes
for processing. Each node selected is processed in turn, using the best 
matching template for that node. Order of processing can be influenced by the 
type of the current node, the XPath axis used in the selection expression 
(ancestor:: for example defaults to reverse document order), and the xsl:sort 
instruction.

The built-in template for the root node and any element node has an
xsl:apply-templates instruction that selects all the children of the current
node. Hence, recursive descension of the source tree occurs by default (but
not into attribute nodes or namespace nodes). The built-in template for a text 
node copies the node to the result tree.

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]