Passing Undefined Parameters with <xsl:call-template> Causes an Error
In XSLT 1.0, you could use <xsl:call-template> to invoke a
template with as many parameters as you wanted. If any of those
parameters weren’t defined in the template, they were ignored. In XSLT
2.0, using <xsl:call-template> with an undefined
parameter causes a fatal error.
Note
It’s not an error to pass undefined parameters with <xsl:apply-templates>, <xsl:apply-imports>, or <xsl:next-match>.
Many times XSLT 1.0 stylesheets passed extra parameters because
they might eventually be needed by another template. Every time
another template was invoked (via <xsl:apply-templates> or <xsl:call-template>), the extra
parameters were passed along. XSLT 2.0 features much more
sophisticated tunnel parameters. A tunnel
parameter isn’t passed to each template, so it makes your stylesheets
much cleaner. See the section Tunnel parameters” in Chapter 5
for more information.
This potential problem is a static error. That means the XSLT 2.0 processor can tell whether you’re passing the wrong number of parameters to a template without actually transforming an XML document.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access