xsl:apply-templates is usually (but not necessarily) used to process all or a subset of children of the current node with all applicable templates. This supports the recursiveness of XSLT application which is matching the (possible) recursiveness of the processed XML.
xsl:call-template on the other hand is much more like a normal function call. You execute exactly one (named) template, usually with one or more parameters.
<xsl:call-template> is almost like calling a function in a traditional programming language. We can define functions in XSLT like below : simple example that prints the output as a string.
<xsl:template name="PrintAdd">
<xsl:text>Printing current address</xsl:text>
</xsl:template>
This function can be called via <xsl:call-template name="PrintAdd"><xsl:apply-templates> is a little different one but it is the real power of XSLT: It takes any number of XML nodes (whatever you define in the select attribute), iterates them ( apply-templates works like a loop!) and finds matching templates for them:
<!-- Example -->
<xml>
<INDIA /><US/><aus/>
</xml>
<!-- Example -->
<xsl:template match="XML">
<xsl:apply-templates select="*" /> <!-- three nodes selected here -->
</xsl:template>
<xsl:template match="INDIA"> <!-- will be called once -->
<xsl:text>INDIA element encountered</xsl:text>
</xsl:template>
<xsl:template match="xml/*"> <!-- will be called twice -->
<xsl:text>other element countered</xsl:text>
</xsl:template>
This way you can give a little control to the XSLT processor - not you decide where the program flow goes, but the processor does by finding the most appropriate match for the node it's currently processing.
xsl:call-template on the other hand is much more like a normal function call. You execute exactly one (named) template, usually with one or more parameters.
<xsl:call-template> is almost like calling a function in a traditional programming language. We can define functions in XSLT like below : simple example that prints the output as a string.
<xsl:template name="PrintAdd">
<xsl:text>Printing current address</xsl:text>
</xsl:template>
This function can be called via <xsl:call-template name="PrintAdd"><xsl:apply-templates> is a little different one but it is the real power of XSLT: It takes any number of XML nodes (whatever you define in the select attribute), iterates them ( apply-templates works like a loop!) and finds matching templates for them:
<!-- Example -->
<xml>
<INDIA /><US/><aus/>
</xml>
<!-- Example -->
<xsl:template match="XML">
<xsl:apply-templates select="*" /> <!-- three nodes selected here -->
</xsl:template>
<xsl:template match="INDIA"> <!-- will be called once -->
<xsl:text>INDIA element encountered</xsl:text>
</xsl:template>
<xsl:template match="xml/*"> <!-- will be called twice -->
<xsl:text>other element countered</xsl:text>
</xsl:template>
This way you can give a little control to the XSLT processor - not you decide where the program flow goes, but the processor does by finding the most appropriate match for the node it's currently processing.