[Logo]
Forums Register Login
xsl:apply-templates element
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.
<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.
Your explanation made it clear Andy. Thanks very much.

Shiva.
brevity is the soul of wit - shakepeare. Tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss


This thread has been viewed 496 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jul 18, 2018 13:58:32.