Re: [xsl] explain of Joerg xslt (was: xsl:copy ...)

Subject: Re: [xsl] explain of Joerg xslt (was: xsl:copy ...)
From: Mike Brown <mike@xxxxxxxx>
Date: Mon, 8 Apr 2002 03:16:22 -0600 (MDT)
I haven't been following this thread, but...

Carsten Klein wrote:
> The match attribute to xsl:template instructs the xsl processor to
> apply this template to all nodes in the source document which match
> the "match" clause.

No, this is completely wrong.

<xsl:template match="..."> does not cause nodes to be processed.
Only xsl:apply-templates and xsl:for-each do that.

All you are doing when you provide a match template is saying that *if* the
processor *happens* to be processing a node that matches given pattern, then
this template *may* be applied.

Processing begins at the root node of the source tree. If you don't provide a
template that matches this node, then a built-in template containing just
<xsl:apply-templates/> is invoked. xsl:apply-templates with no select means
"go process each of the current node's children". There are built-in templates
for each kind of node; the processor falls back on these if there is no better
match. The spec explains what they are and how the best matching template for
a given node is determined.

> Select does not apply to xsl:template. It does apply to
> xsl:call-template or xsl:apply-templates and xsl:for-each
  ^^^^^^^^^^^^^^^^^

It does not apply to xsl:call-template.

> have a look at
> http://www.w3.org/TR/2001/WD-xslt11-20010824/.

That is an expired working draft. Use http://www.w3.org/TR/xslt

> The template is processed for each Indice node in your source
> document. It then creates
> the start tag of a <tree> node in the output tree

No. XPath/XSLT trees do not contain tags. Please learn to differentiate
between an abstract node tree and a serialized representation of it.

> this template now "calls" other templates which may match any
> attribute node <xsl:apply-templates select="@*"/>.

Not really. It tells the processor to go process all the attribute nodes on
the current node (the Indice element being processed). The best matching
template for each attribute is found and its contents instantiated.

I'm stopping here. :)

   - 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


Current Thread