On 30.08.2005 11:57, Reinhard Haller wrote:
Hi,
I want to collect a set of the newest news snippets out of
a nested directory structure like
maindir --+--subdir1--+--file1.xml
| +--file2.xml
+--subdir2-----file3.xml
+--subdir3--+--file4.xml
+--file5.xml
the pipeline match
<map:match pattern="items">
<map:generate type="directory" src="maindir">
<map:parameter name="dateFormat" value="yyyyMMdd"/>
<map:parameter name="include" value="\.xml$" />
<map:parameter name="depth" value="2"/>
<map:parameter name="sort" value="lastmodified"/>
<map:parameter name="reverse" value="true"/>
<map:parameter name="refreshDelay" value="60"/>
</map:generate>
<map:serialize type="xml"/>
</map:match>
doesn't work.
The problem is that the directory structure is hierarchical while the
regexp is flat. The regexps are used on every level of the hierarchy,
i.e. subdir{n} does not match on .xml, so it is not included.
If the regexp is changed to
<map:parameter name="include"
value="(^(subdir1|subdir2|subdir3)$|\.xml$)" />
I've got the desired files, but the sorting is done with the subdir
modified
as first key and the file modified as second key.
It is still a hierarchy, the different levels are sorted individually.
I've two questions:
a) is there a regexp working without the explicit knowledge of the
subdirs?
Unfortunately not.
b) is there a way to get the desired sort based only on the modified
file date?
It should be simple with an XSLT processing afterwards.
The whole problem is your understanding of the matching vs. the working
of the directory generator (which is not very intuitive). Long time ago
there were suggestions to change the directory generator to be ant
based, i.e. using the ant syntax. This would solve all your problems.
Unfortunately nobody started with this change.
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]