The <xsl:param> and <xsl:with-param> Elements:Creating Parameters

Parameters are much like variables, except they’re usually used with named templates. Parameters enable you to pass values into templates. You create parameters with the <xsl:param> element, which has two attributes:

  • name(mandatory). The name of the variable, set to a QName.

  • select(optional). The default value of the parameter. Set to an XPath expression.

Like <xsl:variable>, this element can either be a top-level element or be used inside a template body. Parameters created with top-level <xsl:param> elements are global parameters, and those created inside templates are local parameters. If you create a parameter inside a template body, the <xsl:param> element should come before ...

Get Inside XSLT 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.