|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Tree from directory listing
Hi Mukul, (and others,)
Ah, it does process deeper directories, apart from a minor bug (you are passing @path in the named templates instead of $path). Though, the result doesn't look like what I would have expected. It only merged folders and subfolders properly when the files are sorted in advance, so it seems.. Generalizing on the original question, I feeded your stylesheet the following XML and had to fix the case where the $path contains less than 2 slashes to prevent (another) endless loop: <?xml version="1.0" encoding="UTF-8"?> <root> <file name ="f5.xyz" path="/test2/folderInFolder3/folderInFolder4/"/> <file name ="f1a.xyz" path="/"/> <file name ="f1.xyz" path="/test/"/> <file name ="f4b.xyz" path="/test/folderInFolder2/"/> <file name ="f3.xyz" path="/test/folderInFolder/"/> <file name ="f2.xyz" path="/test/folderInFolder/"/> <file name ="f4.xyz" path="/test/folderInFolder2/"/> <file name ="f5b.xyz" path="/test2/folderInFolder3/"/> </root> (I deliberately mixed the order) I was also wondering what would happen if the input doesn't supply a file for each subfolder that should be output. For example just: <file name ="f1a.xyz" path="/"/> <file name ="f4b.xyz" path="/test/folderInFolder2/"/> The result was getting a bit awkward by this time, so I tried to work out the following approach: build a folder structure for each file separately and merge it in a second step. Less efficient maybe, but it seems to do its job quite well.. If anyone is interested, I'll share the stylesheet... Cheers, Geert The XSL works on folder structure any deep..
http://www.daidalos.nl/ tel:+31-(0)79-3316961 fax:+31-(0)79-3316464 GPG: 1024D/12DEBB50
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








