xsl xml template

gudii9 used Ask the Experts™
In world of xslt and xml when we say template what it exactly means.
Is it is XML template or XSLT template.

when and how we use it.

what it means by default and custom template.
please advise
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
First a XSLT file itself could be called a template for short.

Second, there is the XSLT directive <xsl:template>
It's usage is dual:
It could be used when the XSLT processor finds a match between the pattern defined in the template's match attribute and the node either explicitly selected (using the <xsl:apply-templates select="node to select"/>) or the current node of the default template (see below).
And template could be also called by name (defined in its name attribute), just a regular structural language subroutine:
<xsl:call-template name="some-template-name"/>

The default template is embedded into the XSLT processor and is called when no matched template found in the XSLT file.
What the default template does, it just outputs the text nodes and asks the processor to find a matched template for children nodes.
Hope my explanation is understandable.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial