Re: [xsl] Iterate through tree structure

Subject: Re: [xsl] Iterate through tree structure
From: jim mcgovern <jim.mcgovern2@xxxxxxxxxxxxxx>
Date: Tue, 31 Mar 2009 17:21:59 +0100
Hi

Sure.  Dir3 wouldn't be in the navigation at that level in the example
as its not a parent of Dir4  - its only a child of Dir3.  The
navigation only lists parent directories. So the further you go down
in the navigation the more parents you'll see. Does that make sense?

The last 2 directories need to be a separate UL to accomodate the
stylesheet design - I don't have any control over this as it's from a
different oranisation.

Many thanks

Jim

2009/3/31 Emmanuel Bigui <eb@xxxxxxxxxx>:
> Hi,
>
> Can you explain the requirements further? Why should the result
> have dir1 dir2 and dir4 in the first ul and not dir3? Why does
> dir3 not appear in the result? And why do dir4 and dir5 need
> to be in a separate ul?
>
> It would be straightforward to list all dirs "above" a given
> page, but if one needs to filter some of them out and/or
> organize them in a different system than the source, one
> needs instructions ;-)
>
> Regards,
> EB
>
>> -----Original Message-----
>> From: jim mcgovern [mailto:jim.mcgovern2@xxxxxxxxxxxxxx]
>> Sent: Tuesday, March 31, 2009 5:29 PM
>> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>> Subject: [xsl] Iterate through tree structure
>>
>>
>> Hi there
>>
>> Apologies for the duplicate post but I sent this through hotmail
>> earlier and it stripped the content.  Hopefully this will be more
>> successful...
>>
>> Hopefully someone can help me with something that I thought was going
>> to be straight forward but has been giving me a few problems!
>>
>> I'm trying to generate navigation from an xml file which is pretty
>> much as below:-
>>
>> <dir name="dir1" id="x1">
>>  <page pname = "page1"></page>
>>  <dir name="dir2" id="x2">
>>    <page pname = "page2"></page>
>>   <dir name="dir3" id="x3">
>>     <page pname = "page3"></page>
>>   </dir>
>>   <dir name="dir4" id="x4">
>>     <page pname = "page4"></page>
>>    <dir name="dir5" id="x5">
>>      <page pname = "page5"></page>
>>      <page pname = "page6"></page>
>>     <dir name="dir6" id="x6">
>>       <page pname = "page6"></page>
>>     </dir>
>>    </dir>
>>   </dir>
>>  </dir>
>> </dir>
>>
>> The above is a snapshot as it can go down "n" levels.  If I'm at page6
>> then my navigation needs to be:-
>>
>> <ul>
>>   <li>dir1</li>
>>   <li>dir2</li>
>>   <li>dir4</li>
>> </ul>
>> <ul>
>>   <li>dir5</li>
>>   <li>dir6</li>
>> </ul>
>>
>> What I'm having difficulty with is how to close the opening ul and
>> open a new ul when I'm a directory up from the directory level I'm
>> actully on.

Current Thread