[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.

This thread has been viewed 521 times.

All times above are in ranch (not your local) time.
The current ranch time is
Oct 17, 2018 10:07:53.