Look this xsl template:
<xsl:template match="root">
<xsl:param name="bla" select="/.." />
<ha>
<xsl:value-of select="$bla" />
</ha>
</xsl:template>
The part “select=”/..” don’t throw an exception (for me, the right xpath is ../), but does nothing.
Why define a parameter like that ?
If i execute the template without pass the “bla” parameter, “ha” will be empty, otherwise it will contain the value passed.
Thanks
This is useful in XSLT 1.0 to indicate that the type of an
xsl:paramor anxsl:variableis node-set.Then the XSLT processor will not produce an error on expression like:
On the contrary, if you just define the parameter without giving it any default value, the expression above produces an error — sometnhing like:
“Expression must evaluate to a node-set“
Easy verification:
Try this (works OK):
and this (results in error):