When a parameter is used to select nodes by position, be careful not to do the following:
<xsl:param name="n">2</xsl:param>
...
<xsl:value-of select="item[$n]"/>
This will output the value of the first item element, because the variable "n" will be bound to a result tree fragment, not a number. Instead, do either
<xsl:param name="n" select="2"/>
...
<xsl:value-of select="item[$n]"/>
or
<xsl:param name="n">2</xsl:param>
...
<xsl:value-of select="item[number($n)]"/>