[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] building hierarchy from path string


Subject: Re: [xsl] building hierarchy from path string
From: "John-Mason P. Shackelford" <john-mason@xxxxxxxxxxxxxxx>
Date: Wed, 05 Dec 2001 11:25:54 -0600

Joshua, (& others!)

Thanks much! This gives me a good place to start.

I'd like to be able to handle path stings of arbitrary depth, so I'll try to modify your template to handle it. One approach would be to have a style sheet that generates another based on one look at the path. The two variables I must be perpared to handle are: (1) each level of depth is represented by a number of fixed within tree, but which may vary from tree to tree. (2) each tree has a specified depth which maybe obtained by dividing the path the by the number of characters representing each level. The path will always be the same length with in the tree, and (as you aptly detected) zeros always indicate that node is a parent for a given level. BTW this is a handy way to store & manipulate hierarchical data in a database--everybody's worst nightmare :).

I could pass the the info to the stylesheet by writing my xml this way:

<tree>
   <descriptor chars-per-tier="2" depth="3" />
   <node-list>
       <node depth="0" OID="1" name="Animals" path="100000" />
       <node depth="1" OID="2" name="Reptile" path="102000" />
       <node depth="2" OID="5" name="Snake" path="102010" />
       <node depth="2" OID="6" name="Crock" path="102020" />
       <node depth="2" OID="7" name="Gator" path="102030" />
       <node depth="1" OID="3" name="Bird" path="103000" />
       <node depth="1" OID="4" name="Mamal" path="103000" />
   </node-list>
</tree>

Thanks again, Joshua, for pointing me in the right direction with all of this. I'll crunch on it some and let you know what I come up with. Others--feel free to chime in!

John-Mason
--
http://john-mason.shackelford.org


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




Current Thread
Keywords
xml