Recursion and dead ends

So the process is recursive in that you keep drilling down the input tree and processing the children, and then their children, and so on. But it can also come to a dead end. The drilling-down process requires that we receive an instruction to continue applying templates (using the <xsl:apply-templates> element).

In the diagram, we can see that the <xsl:apply-templates> instruction is really the key to everything past step 3. It is this element that allows the stylesheet to process any children of <lg> (i.e. <opener>, <l>, and <byline>). If this element is absent, nothing else happens. The stylesheet isn’t instructed to process more children, so the children are ignored.

Note that although this diagram does not show how each <l> element is processed, each would treated in the same way as the first two in the output document (that is, transformed into HTML <p> elements.

A Gentle Introduction to XSLT slide 07 of 8
© 2012 Syd Bauman, Julia Flanders, and the Women Writers Project This TEI-encoded XML file is available under the terms of the Creative Commons Attribution-ShareAlike 3.0 (Unported) license.