Welcome to the Mythicsoft Q&A site for:

- Agent Ransack
- FileLocator Lite
- FileLocator Pro

Please feel free to ask any questions on these products or even answer other community member questions.

Useful Links:

- Contact Us
- Help Manuals
- Mythicsoft Home
0 votes

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.:


I am looking for a single:


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

asked by (70 points)

1 Answer

+1 vote
Best answer

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"

  <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 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')"/>
answered by (63.3k points)
You are correct. Had I unfortunately had .rar somewhere in the path a second time before the actual name, this would have given inaccurate results. Fortunately, I avoided that trap and this worked perfectly. Thank you VERY MUCH.

I am unfamiliar with xsl. Can you recommend a good tutorial which might also include applying regex principles so that I might filter out the part2, Part3, results etc without having to filter through a separate external script? (So that HOPEFULLY I don't have to bother you again.)