I suspect you want something like this:
<xsl:for-each select="//*[matches(., concat('\W', $term, '\W'), 'im')]">
<xsl:sort select="count(ancestor::node())" order="descending"/>
<xsl:if test="position()=1">
<path>/<xsl:value-of select="saxon:path()"/></path>
</xsl:if>
</xsl:for-each>
Michael Kay
http://www.saxonica.com/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--