8.4. Comparing <xsl:variable> and <xsl:param>

Syntactically, there is no difference between <xsl:variable> and <xsl:param>. The content model of both elements is the same. The way these elements declare variables is the same. However, the value of the variable declared using <xsl:param> is only a default that can be changed with the <xsl:with-param> element, while the <xsl:variable> value cannot be changed. The only other difference is that there is a restriction on where the <xsl:param> element can be used. It must always come before any other elements if used within a template rule.

Because <xsl:variable> and <xsl:param> declare variables in the same way, if they are both present in the same context and they both have the same name, they are ...

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.