Re: [xsl] Default tunnel parameters.

Subject: Re: [xsl] Default tunnel parameters.
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 26 Aug 2008 15:46:13 +0100
> Can you please estimate the value reported in xsl:message in a following stylesheet?
> Saxon 9.1 reports value 2.
> My expectation is 1.
> If 2 is correct output then can you please justify it.
>
> <xsl:stylesheet version="2.0"
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>  xmlns:xs="http://www.w3.org/2001/XMLSchema";
>  xmlns:p="http://www.nesterovsky-bros.com";>
>
>  <xsl:template match="/">
>    <xsl:call-template name="p:test"/>
>  </xsl:template>
>
>  <xsl:template name="p:test">
>    <xsl:param name="index" as="xs:integer" select="1"/>
>    <xsl:param name="value" tunnel="yes" as="xs:integer" select="$index"/>
>
>    <xsl:choose>
>      <xsl:when test="$index lt 2">
>        <xsl:call-template name="p:test">
>          <xsl:with-param name="index" select="$index + 1"/>
>        </xsl:call-template>
>      </xsl:when>
>      <xsl:otherwise>
>        <xsl:message select="$value"/>
>      </xsl:otherwise>
>    </xsl:choose>
>  </xsl:template>
>
> </xsl:stylesheet>


2 is correct

@tunnel="yes" on xsl:param means take the tunnelled parameter and not
the local one.  Because you've not tunnelled that parameter (using
tunnel="yes" on xsl:with-param) then it takes the local copy, which is
2.

In other words, @tunnel on xsl:param is useless without a matching
@tunnel on xsl:with-param somewhere higher up the call stack

-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread