8.5. Comparing <xsl:with-param> to <xsl:param> and <xsl:variable>

The <xsl:with-param> element has the same content model and declares a variable in the same manner as <xsl:variable> and <xsl:param>. However, <xsl:with-param> must be used inside either <xsl:apply-templates> or <xsl:call-template>, and using it replaces the value of the variable that was declared using the original <xsl:param>. If there is no <xsl:param> declaration in the template being called, the variable is ignored. The <xsl:with-param> element cannot be used to change the value of a variable declared with <xsl:variable>.

Example 8-8. Extended example using <xsl:param> and <xsl:with-param>.
					STYLESHEET: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> ...

Get XSLT and XPATH: A Guide to XML Transformations now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.