SLAX Parameter Passing Overview

You can pass parameters to match templates using the with statement. The with statement consists of the keyword with and the name of the parameter, optionally followed by an equal sign (=) and a value expression. If you do not specify a value, the current value of the variable or parameter is passed.

match configuration {
    var $domain = domain-name;
    apply-templates system/host-name {
        with $message = "Invalid host-name";
        with $domain;
    }
}
 
match host-name {
    param $message = "Error";
    param $domain;
    <hello> $message _ ":: " _ . _ " (" _ $domain _ ")";
}

The XSLT equivalent is:

<xsl:template match="configuration">
    <xsl:apply-templates select="system/host-name">
        <xsl:with-param name="message" select="'Invalid host-name'"/>
        <xsl:with-param name="domain" select="$domain"/>
    </xsl:apply-templates>
</xsl:template>
 
<xsl:template match="host-name">
    <xsl:param name="message" select="'Error'"/>
    <xsl:param name="domain"/>
    <hello>
        <xsl:value-of select="concat($message, ':: ', ., ' (', $domain, ')')"/>
    </hello>
</xsl:template>