Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

When do I use xsl:call-template vs. xsl:apply-templates?

apply-templates vs XSL
0
Posted

When do I use xsl:call-template vs. xsl:apply-templates?

0

I’m still kind of vague on this. xsl:apply-templates seems like it’s more compatible with XSL’s declarative style, so my current approach is to use xsl:apply-templates whenever possible. Kevin Williams calls this Push vs. Pull style. Use xsl:call-template when you need to control where data is going to appear; e.g. a reference list at the end of a paper (xsl:copy-of can also be useful for this, but that doesn’t let you process the data). You should also use xsl:call-template when you want to reuse a copy of some data; e.g. using chapter titles at the beginning of a document for a table of contents. One more thing; remember that apply-templates changes the current context, whereas call-template does not; i.e.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123