xsl-list
[Top] [All Lists]

Re: Flat -> Hierarchy --- Continue

2003-05-28 15:51:49

Sorry,

here is the output I want:

------------------------------------------------------
<Members>
    <Member>
      <Label>parent</Label>
      <Description>r1</Description>     
      <Member>
         <Label>firstchild</Label>
         <Description>r2</Description>
      </Member>
      <Member>
        <Label>secondchild</Label>
        <Description>r3</Description>
        <Member>
                <Label>firstgrandchild</Label>
                <Description>r3</Description>
        </Member>
      </Member>
    <Member>
 </Members>
-----------------------------------------------------

Dongling

--- Dongling Ding <dling61(_at_)yahoo(_dot_)com> wrote:

Hi,


I think there were some discussion about this topic
already. But my case is a little different from
others. I have a flat structure that need to be
converted into a hierarchy based on another set of
elements that define the relationship between
members.


I tried to use recursive and xsl:key methods and it
seems like both of the two methods couldn't solve
the
problem.

I am wondering if anyone has an idea on this
particular case. Any help would be very appreciated!


Input:

-----------------------------------------------------
<Members>
              <Member>
                      <Label>parent</Label>
                      <Description>r1</Description>
              </Member>
              <Member>
                      <Label>firstchild</Label>
                      <Description>r2</Description>
              </Member>
              <Member>
                      <Label>secondchild</Label>
                      <Description>r3</Description>
              </Member>
              <Member>
                      <Label>firstgrandchild</Label>
                      <Description>r3</Description>
              </Member>
</Members>
<hierarchy>
              <node>
                      <parent>parent</parent>
                      <child>firstchild</child>
              </node>
              <node>
                      <parent>parent</parent>
                      <child>secondchild</child>
              </node>
              <node>
                      <parent>parent</parent>
                      <child>secondchild</child>
              </node>
              <node>
                      <parent>secondchild</parent>
                      <child>firstgrandchild</child>
              </node>
</hierarchy>

------------------------------------------------------

Output:
----------------------------------------------------
<Members>




__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to
Outlook(TM).
http://calendar.yahoo.com



__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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