[xsl] getting all nodes from a certain level in the xml hierarchy

Subject: [xsl] getting all nodes from a certain level in the xml hierarchy
From: "Peter Menzel" <mai00bfy@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 27 Sep 2002 11:14:12 +0200

my problem is the following:
my XML document maps the structure of a folder tree (just like the unix file
hierarchy) but without files, e.g.:

<Folder NAME="/">
  <Folder NAME="a"/>
  <Folder NAME="b">
    <Folder NAME="ba"/>
    <Folder NAME="bb"/>
  <Folder NAME="z">
    <Folder NAME="za">
                <Folder NAME="very deep folder"/>

The real folder NAMEs are like real folder names, and have no specific
length or content.
The depth of the deepest node is unknown.

I need to access all nodes that have the same depth.
So first i need root, then all direct childs of root, then all nodes that
are two levels under root, because i want tu put them in a table like:

level | 0 |  1  |  2   ...         x
------+---+-----+------     ---------------
      | / |  a  |  ba       very deep folder
      |   |  b  |  bb
      |   |  z  |  za

first I started to try <xsl:for-each select="//Folder"> and then
<xsl:for-each select="//Folder/Folder"> but because I do not know the depth
of the tree, this won't work..

Can anybody help me, what is the direction i should go?
I don't think there is an easy way to use XPath for adressing nodes on the
same level?

Nice greetings, Peter

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

Current Thread