What makes you think that procedural conditions are not applicable here? It is simply that the calling convention is somewhat more implicit than you traditionally expected, because there is an invisible context. All apply-templates can be expressed in procedural terms.
Basically, apply-templates is nothing more than a for-each loop. Starting from where you are in the document (context, think " this "), it iterates over the child nodes.
For each child, the processor selects the appropriate xsl:template with the highest priority (based on the corresponding match and priority attributes), sets the context for the child, and launches this template (think " function "). After returning the template, the context bounces back and the next child addresses it.
Even when things become recursive (which is difficult to avoid in XSLT), the whole process does not really get complicated. The pointer context moves and templates are called.
You can restrict the node set that iterates apply-templates using the select attribute:
<xsl:apply-templates /> <xsl:apply-templates select="data[@name='Foo']" />
You can sort node -set before iteration if you want:
<xsl:apply-templates select="data[@name='Foo']"> <xsl:sort select="count(detail)" data-type="number" order="descending"/> </xsl:apply-templates>
And you can pass parameters to your template if you need, just like with a regular function call:
<xsl:apply-templates select="data[@name='Foo']"> <xsl:with-param name="DateSetIcon" select="$img_src" /> </xsl:apply-templates>
It is all about him.
EDIT:
I know the last comment is a bit provocative. This is very intense since the basic understanding of how apply-templates works is more or less. The consequences and opportunities that come from the fact that you do not determine which template to call, but rather allow the processor to choose the right one for you, are, of course, more than what sounds like an unprepared ear. The declarative / implicit approach of all this certainly takes some time to drown.