xsl:param (template)

  • Parameters can be defined on the template level.

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template name="test">
        <xsl:para name="param1" select="'default-string'"/>
      </xsl:template>
    </xsl:stylesheet>
    					
  • This allows calling templates to pass parameters using the with-param element.

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template match="/">
        <xsl:call-template name="test">
          <xsl:with-param name="param1" select="'test'"/>
        </xsl:call-template>
      </xsl:template>
    
      <xsl:template name="test">
        <xsl:para name="param1" select="'default-string'"/>
      </xsl:template>
    </xsl:stylesheet>