This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Creating a heirarchal unordered list from flat file


Let me just provide the framework, and you can implement it in XSL:

You need a recursive template called something like
"OutputNodeAndItsChildren".  Its implementation, when called with a node as
parameter, is:
  - output the node header
  - identify the node's children
  - for each of those children, call "OutputNodeAndItsChildren" with the
child as parameter.

Then your processing consists of only this:
  - identify the root node (parentID="0" perhaps?)
  - call "OutputNodeAndItsChildren" with the root node as parameter.

That's it.
PC2

-----Original Message-----
From: David Marsh [mailto:DMarsh@fscnet.com]
Sent: January 25, 2001 12:46
To: XSL-List@lists.mulberrytech.com
Subject: [xsl] Creating a heirarchal unordered list from flat file


I'm trying to create a heiarchal Ordered list from an XML file gererated
from SQL server.  The XML file is a flat representation of heirarchal data.
It looks like this:

<Root>
  <Groups GroupID="1" Name="Group1" ParentID="0">
  <Groups GroupID="2" Name="Group2" ParentID="1">
  <Groups GroupID="3" Name="Group3" ParentID="1">
  <Groups GroupID="4" Name="Group4" ParentID="1">
  <Groups GroupID="5" Name="Group5" ParentID="2">
  <Groups GroupID="6" Name="Group6" ParentID="2">
  <Groups GroupID="7" Name="Group7" ParentID="3">
  <Groups GroupID="8" Name="Group8" ParentID="3">
  <Groups GroupID="9" Name="Group9" ParentID="4">
  <Groups GroupID="10" Name="Group10" ParentID="5">
  <Groups GroupID="11" Name="Group11" ParentID="5">
  <Groups GroupID="12" Name="Group12" ParentID="6">
  <Groups GroupID="13" Name="Group13" ParentID="8">
  <Groups GroupID="14" Name="Group14" ParentID="8">
  <Groups GroupID="15" Name="Group15" ParentID="9">
  <Groups GroupID="16" Name="Group16" ParentID="10">
  <Groups GroupID="17" Name="Group17" ParentID="10">
  <Groups GroupID="18" Name="Group18" ParentID="16">
  <Groups GroupID="19" Name="Group19" ParentID="18">
  <Groups GroupID="20" Name="Group20" ParentID="19">
  ...
<Root>

The groups list will grow over time.
I want to transform it into an HTML document to an Unordered list that will
show the heirarchical structore of the file.  
Example:

* Group1
      * Group2
            * Group5
                  * Group10
                        * Group16
                              * Group18
                                    * Group19
                                          * Group20
                        * Group17
                  * Group11
            * Group6
                  * Group12
      * Group3
            * Group7
            * Group8
                  * Group13
                  * Group14         
      * Group4
            * Group9
                  * Group15

Is there an easy way to do this with XSL.  I'm new at this and I'm kind of
stumped right now.



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]