Subject: [xsl] Is this node, the document root... best test?|
From: Stephen Cunliffe <scunliffe@xxxxxxxxxxxxxxxxxx>
Date: Mon, 20 Oct 2003 10:58:58 -0400
<xsl:template match="*" mode="someTemplate"> <xsl:choose> <!-- Method (1) --> <xsl:when test="not(parent::*)"> This works, but is it safe/efficient? </xsl:when> <!-- Method (2) --> <xsl:when test="string(name(parent::*)) = ''"> This works, but is it safe/efficient? </xsl:when> <xsl:otherwise>This node, is *NOT* the root node...</xsl:otherwise> </xsl:choose> </xsl:template>
PPS I want to be careful, that I don't try and match the node's "name" against the document root node's "name", as this may provide a false match.