List just the parent compressed files instead of individual files containing search terms

I generated a list of RAR files and then searched the contents from within the resulting list. However, I have been unable to figure out a way to export a list which contains only the names of the RAR files which had a match. The closest I can get is the "unique folders" xsl transform which yields a separate line for each folder within the RAR file, i.e.:

\path\to.rar\path\within\


I am looking for a single:

\path\to.rar


line for each which contains any number of results, and if possible, a 'hit count" for the entire compressed file. I tried ALL of the xsl transforms to no avail. Each generated a separate line for each file result within the compressed file. And I cannot find a reference to the generate_id () function within the xsl transforms with which I might create my own. And I have found no way to accomplish the same within the "Reports" feature.

Any help is appreciated

+1 vote

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>&#13;&#10;</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>