• Post Reply Bookmark Topic Watch Topic
  • New Topic

xsl:apply-templates element

 
Shiva Samala
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am bit confused with the working of the <xsl:apply-templates> element
. When to use this element? What effect does it produce? Can someone please clarify?

Thanks,
Shiva.
 
Andy Smith
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<xsl:apply-templates> is used for the processing of the children....otherwise the processing will stop there

e.g ur xml is:-
<html>
<body
<table>
<tr>....</tr>
</table>
</body>
</html>


XSL:

<xsl:template match="html">
......ur statements here....
</xsl:template>

<xsl:template match="body">
......ur statements here....
</xsl:template>

<xsl:template match="table">
......ur statements here....
</xsl:template>


after matching the <html> the processing will stop as children are not called...

<xsl:template match="html">
......ur statements here....
<xsl:apply-templates/>

</xsl:template>

<xsl:template match="body">
......ur statements here....
<xsl:apply-templates/>

</xsl:template>

<xsl:template match="table">
......ur statements here....
<xsl:apply-templates/>
</xsl:template>


<xsl:apply-templates/> in <html> match will call for the procesing of <body> child
<xsl:apply-templates/> in <body> match will call for the procesing of <table> child and so on...
i hope i m clear.
 
Shiva Samala
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your explanation made it clear Andy. Thanks very much.

Shiva.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!