469,267 Members | 979 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,267 developers. It's quick & easy.

What does this do: <xsl:apply-templates select="." />

KJ
What does this do: <xsl:apply-templates select="." /> ?

Jul 20 '05 #1
7 1888
KJ wrote:
What does this do: <xsl:apply-templates select="." /> ?

Applies the best matching template for the current context node.

Unless inside a for-each, it will cause infinite recursion...

Soren
Jul 20 '05 #2
KJ
If inside a template, such as:

<xsl:template match="para" mode="note">
<xsl:apply-templates select="." /><br />
</xsl:template>

Then does it only match para's inside notes? Or does it match para's
children also, or what? I didn't write this, only trying to understand
someone else's code.

Jul 20 '05 #3

"KJ" <n_**********@mail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
If inside a template, such as:

<xsl:template match="para" mode="note">
<xsl:apply-templates select="." /><br />
</xsl:template>

Then does it only match para's inside notes?
No, this template will only be selected for processing of a "para" element
if the corresponding xsl:apply-templates had its "mode" attribute set to
"note".

Once selected for processing it delegates this processing to the "normal"
template (without mode specified), that matches a "para".

This code may have been written when the author realised the need for a
special mode of processing "para"s but didn't have time to fully implement
it and as a first step just wrote the moded template as a wrapper of the
normal template.

Or such a template may include the normal processing and also do something
in addition (not shown in the above code) both before or after the normal
processing.
Or does it match para's
children also,
No.

Cheers,
Dimitre Novatchev

or what? I didn't write this, only trying to understand
someone else's code.

Jul 20 '05 #4
KJ
So the <xsl:apply-templates select="." /> part of the block does the
delegation of processing to the "normal" template (without mode
specified) then?

Jul 20 '05 #5

"KJ" <n_**********@mail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
So the <xsl:apply-templates select="." /> part of the block does the
delegation of processing to the "normal" template (without mode
specified) then?


Yes
Jul 20 '05 #6
KJ
thanks so much to all

Jul 20 '05 #7
KJ <n_**********@mail.com> wrote:
What does this do: <xsl:apply-templates select="." /> ?


It produces an infinite loop.
http://www.w3.org/TR/xslt#section-Ap...Template-Rules

Greets
Andreas
--
Kraftl EDV - Dienstleistungen
Linux, Schulungen, Webprogrammierung, Webdesign
Telefon: +43(0)676/3533220
E-mail: An************@kraftl.at, Homepage: http://www.kraftl.at/
Jul 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.