Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 09:40 AM
KJ
Guest
 
Posts: n/a
Default What does this do: <xsl:apply-templates select="." />

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

  #2  
Old July 20th, 2005, 09:40 AM
Soren Kuula
Guest
 
Posts: n/a
Default Re: What does this do: <xsl:apply-templates select="." />

KJ wrote:
[color=blue]
>What does this do: <xsl:apply-templates select="." /> ?
>
>
>[/color]
Applies the best matching template for the current context node.

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

Soren
  #3  
Old July 20th, 2005, 09:40 AM
KJ
Guest
 
Posts: n/a
Default Re: What does this do: <xsl:apply-templates select="." />

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.

  #4  
Old July 20th, 2005, 09:40 AM
Dimitre Novatchev
Guest
 
Posts: n/a
Default Re: What does this do: <xsl:apply-templates select="." />


"KJ" <n_o_s_p_a__m@mail.com> wrote in message
news:1117228956.799253.270520@g44g2000cwa.googlegr oups.com...[color=blue]
> 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?[/color]

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.
[color=blue]
> Or does it match para's
> children also,[/color]

No.

Cheers,
Dimitre Novatchev

[color=blue]
> or what? I didn't write this, only trying to understand
> someone else's code.[/color]


  #5  
Old July 20th, 2005, 09:40 AM
KJ
Guest
 
Posts: n/a
Default Re: What does this do: <xsl:apply-templates select="." />

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

  #6  
Old July 20th, 2005, 09:40 AM
Dimitre Novatchev
Guest
 
Posts: n/a
Default Re: What does this do: <xsl:apply-templates select="." />


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

Yes


  #7  
Old July 20th, 2005, 09:40 AM
KJ
Guest
 
Posts: n/a
Default Re: What does this do: <xsl:apply-templates select="." />

thanks so much to all

  #8  
Old July 20th, 2005, 09:40 AM
Andreas Kraftl
Guest
 
Posts: n/a
Default Re: What does this do: <xsl:apply-templates select="." />

KJ <n_o_s_p_a__m@mail.com> wrote:[color=blue]
> What does this do: <xsl:apply-templates select="." /> ?[/color]

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: Andreas.Kraftl@kraftl.at, Homepage: http://www.kraftl.at/
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles