Defaults

1. Tunneling
2. Default parameter type
3. Parameter pass-through or tunneling using default templates

1.

Tunneling

Mike Kay



>  Shouldn't a named template being called with tunnelled parameters 
> that it is not using (but only tunnelling further down), not have to 
> declare these parameter(s) ?

Some misunderstanding here, I suspect. The rule for named templates is exactly the same as for apply-templates: you only declare the parameter at the two ends of the tunnel: when the parameter is first created using xsl:with-param, and in a template that actually uses it with xsl:param.

2.

Default parameter type

Mike Kay




> <xsl:function name="njp:forwardURL">
> <xsl:param name="placeholder"/>

> I _think_ that makes this param a string 

No, the default type is "item()*" which accepts anything (any sequence of items). The default value of this param is a zero-length string, but the supplied value can be anything you like.

3.

Parameter pass-through or tunneling using default templates

DuCharme, Bob

At XSLT 1.0, if a built-in template rule was invoked with parameters, the parameters were not passed on to any templates invoked by the built-in rule. At XSLT 2.0, these parameters are passed through the built-in template rule unchanged.

using this input document

  <a><b><c/></b></a>

and this stylesheet:

  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  version="2.0">
    <xsl:output omit-xml-declaration="yes"/>

    <xsl:template match="a">
      <xsl:apply-templates>
        <xsl:with-param name="flavor">mint</xsl:with-param>
      </xsl:apply-templates>
    </xsl:template>

    <xsl:template match="c">
      <xsl:param name="flavor">vanilla</xsl:param>
      Today's flavor: <xsl:value-of select="$flavor"/>
    </xsl:template>

  </xsl:stylesheet>

The output indicated that the $flavor value of "mint" had been passed.