xsl-list
[Top] [All Lists]

Re: Tree from directory listing

2004-12-16 01:55:39
Hi Geert,
  Thanks a lot for pointing the bug.. I was infact
testing my stylesheet again, and was getting
StackOverFlow error. And your mail pointed the bug..
Thanks for saving my time!

I suggest, please post your XSL. It'll help the
original poster.

Regards,
Mukul

--- Geert Josten <Geert(_dot_)Josten(_at_)daidalos(_dot_)nl> wrote:

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

Regards,
Mukul

--- Geert Josten <Geert(_dot_)Josten(_at_)daidalos(_dot_)nl> wrote:


Hi,

Ah! It took a second look to notice that the
xsl:key
is being applied to the contents of the RTF 
variable as well... :)

Does it work on a three level deep folder
structure
as well?

Cheers

Mukul Gandhi wrote:


Below is a XSLT 1.0 solution. I have used the

node-set

extension function..




            
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 




--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




-- 
Geert(_dot_)Josten(_at_)Daidalos(_dot_)nl
IT-consultant at Daidalos BV, Zoetermeer (NL)

http://www.daidalos.nl/
tel:+31-(0)79-3316961
fax:+31-(0)79-3316464

GPG: 1024D/12DEBB50


--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





        
                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>