XSLT - Passing nodes as a parameter to templates

im scratching my head here, hopefully someone can help me out.

Im trying to pass a set of nodes as a parameter to an xslt template. thats about it.

   <xsl:param name="currentPage"/>   

<xsl:template match="/">
<xsl:choose>
<xsl:when test="$currentPage/@level=3">
<xsl:call-template name="test">
<xsl:with-param name="nodes">
<xsl:value-of select="$currentPage/../node" />
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="test">
<xsl:with-param name="nodes">
<xsl:value-of select="$currentPage/../../node" />
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="test">
<xsl:param name="nodes"></xsl:param>
<xsl:value-of select="count($nodes)" />
</xsl:template>

 

It errors on trying to print out the count of $nodes. Due to this i cant loop through it and do what i need to do. However just outputting $nodes within the test function does output values to the page. What am i doing wrong? :S

 

Thanks!


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/10317-xslt-passing-nodes-as-a-parameter-to-templates