It's tricky because from the data perspective 'to.rar
' is just another folder, you could in fact have a parent folder called 'archive.rar
'.
The best I can think of is to use '.rar' to find the root archive using the 'substring-before' function on the path, e.g.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rslt="http://www.mythicsoft.com/FileLocator_16Aug2005"
version="1.0">
<xsl:output method="text" indent="yes"/>
<xsl:key name="folders-value" match="rslt:file" use="substring-before(rslt:path, '.rar')" />
<xsl:template match="/">
<xsl:apply-templates select="//rslt:file"/>
</xsl:template>
<xsl:template match="rslt:file">
<xsl:if test="generate-id() = generate-id(key('folders-value',substring-before(rslt:path, '.rar')))">
<xsl:value-of select="concat(substring-before(rslt:path, '.rar'), '.rar')"/>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>