[xsl] need to write multiple branching tree hierarchies as numbered lists

Subject: [xsl] need to write multiple branching tree hierarchies as numbered lists
From: Mark Fletcher <dafletcha@xxxxxxxxx>
Date: Thu, 29 Mar 2007 09:44:29 -0700 (PDT)
I have a structure in which reflexive nested elements need to be 
represented as ordered siblings. To complicate matters, a parent
element can 
contain multiple children -- each with their own nested descendants.
   
I'm probably not explaining this very well, so here's an example:
   
  <wrapper>
    <step name="A">
      <step name="AA">
        <step name="AAA"/>
        <step name="AAB"/>
      </step>
      <step name="AB">
        <step name="ABA"/>
      </step>
    </step>
    <step name="B">
      <step name="BA"/>
    </step>
  </wrapper>
   
In my output, I need to represent the ancestry of each terminal step 
as a numbered list:
   
  1. A
  2. AA
  3. AAA
   
  1. A
  2. AA
  3. AAB
   
  1. A
  2. AB
  3. ABA
   
  1. B
  2. BA
   
My inclination is build the main loop on the terminal steps, ie. 
for-each select="//step[not(step)]". But I'm not sure where to go after
that, since climbing backward through parent::step will build the list
in reverse.  Perhaps storing the id of the terminal step and passing
that along to a recursive template that walks descendants of 
ancestor::step[1]?
   
(BTW, the name attribute is for demonstration only, I don't have an 
attribute that I can sort on.)
   
I'd appreciate any help!



 
____________________________________________________________________________________
We won't tell. Get more on shows you hate to love 
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265 

Current Thread