| Wendell Piez For comprehension purposes, it may help to know that by default,
<xsl:apply-templates/> selects all the element children of the context
node, and processes them using whichever templates in the stylesheet match.
This recursive processing makes for very simple specification of
straightforward transformations. You can also say <xsl:apply-templates
select="Chapter"/> (using the XPath expression language) if, for example,
you only wanted to process the element children of type 'Chapter'. Try it out and see if the lights go on ... most new users of XSL have to
have an "aha!" or two. Hoping that helps, Mike Kay adds: There are two main ways of approaching stylesheet design:
input driven (push) and output driven (pull). With the former, write a rule
for everything that might be encountered in the input, and tell the
processor what to do when it is found. With the second, structure the
stylesheet according to the output you want to produce, and at each stage,
pull in the relevant input from the source document. It's not at all clear
from your problem description which style is appropriate here. But it looks
a bit to me as if you are thinking in terms of a third style, which is not
available in XSLT, in which the the result tree is built non-sequentially.
Try to get that out of your thinking. |