> <apply-templates> means to process all child nodes. The default action for
> a text node, which you haven't overridden, is to output the text.
Follow-ups set to comp.text.xml.
Mark Space <markspace@sbc.global.net> wrote in
<ZQDTi.235$Nz7.5@nlpi070.nbdc.sbc.com>:
>> <apply-templates> means to process all child nodes. The
>> default action for a text node, which you haven't
>> overridden, is to output the text.
The meaning of xsl:apply-templates without select attribute
is described in detail in XSLT 1.0 spec, 5.4. Built-in
template rules are described in 5.8.
> I'm still trying to wrap my head around how the processing
> actually occurs.
Unless I've mistaken the intent of your question, here's the
gist of how XSLT processing works:
An XSLT stylesheet is a set of templates describing how to
construct result tree fragments, using literal result
elements, xsl:element, xsl:attribute, xsl:value-of etc.
Those templates are applied to various node lists.
Of particular interest is xsl:apply-templates and similar
constructs (xsl:apply-imports, xsl:for-each). Those
construct a resulting tree fragment by selecting a nodeset
(by evaluating an XPath expression in select attribute if
specified, or as described in 5.4 otherwise), using it as
current node list and applying templates to it.
The template chosen for every node or attribute in a node
list depends on a set of hairy rules described in 5.5,
involving stuff like 'import precedence', template
specificity, priority attributes on corresponding
xsl:template elements, mode attribute of
xsl:apply-templates, and the particular instruction invoked
to apply templates, but most of that is of little interest
unless/until you run into problems with it.
To start the transformation, an XSLT processor selects the
document node (/) as a current node list and applies
templates to it. The process continues recursively until a
template is reached that constructs a resulting tree
fragment without applying templates to anything else.
How does that work with your sample document and stylesheet:
1. Current node list: document node (/).
Template applied (built-in):
<xsl:template match="*|/">
<xsl:apply-templates/>
</xsl:template>
2. Current node list: root element 'monkey'.
Template applied:
<xsl:template match="/monkey">
Jumping: <xsl:value-of select="boy/@can"/>
<xsl:apply-templates/>
</xsl:template>
3. Current node list: element 'boy'.
Template applied (built-in):
<xsl:template match="*|/">
<xsl:apply-templates/>
</xsl:template>
4. Current node list: element 'jump'.
Template applied (built-in):
<xsl:template match="*|/">
<xsl:apply-templates/>
</xsl:template>
5. Current node list: text node 'I can't jump'.
Template applied (built-in):
<xsl:template match="text()|@*">
<xsl:value-of select="."/>
</xsl:template>
The RTF for 5 therefore is:
I can't jump.
For 4 and 3:
I can't jump.
For 2:
Jumping: no
I can't jump.
For 1:
Jumping: no
I can't jump.
> That's good, because the more I look at the actual input
> file, the more it appears it was not designed with any
> kind of XSL in mind.
I fail to see what leads you to this conclusion.
Oh, and:
Andrew Thompson <u32984@uwe> wrote in <7a264236381b4@uwe>:
> <http://www.w3schools.com/xsl/xsl_apply_templates.asp>
> "The <xsl:apply-templates> element applies a template
> to the current element *or to the current element's child
> nodes.*"
Just goes to show you how little clue those guys at
w3schools have. Not the first time they've been caught at
blatant lies, either.

Signature
It is rare to find learned men who are clean, do not stink,
and have a sense of humour. -- Liselotte in a letter to
Sophie, 30 Jul 1705