xsl-list
[Top] [All Lists]

climbing to the root element

2005-02-16 06:24:11
Hello!

My xml doc has a structure like the one at the end of this letter.
If an item has a nametype=multiple, then I have to
prefix their nametext with their containing item nametext.
I have to repeate it as many times as multiple type items cascaded
together, plus the one item with simple type above them.

The expected output is this:
a
b
bi
biv
bj
c

There are several other container elements between the simple and
multiple type items, so i can't predict how deep I am, and how far
should i look for the parent item.

My real problem is that I can't make a recursive function to go back
to the / direction.

Could you give me some ideas?

Thank you!

Csaba



<xml>
  <item>
    <itemname nametype="simple">
      <nametext>a</nametext>
    </itemname>
  </item>
  <item>
    <itemname nametype="simple">
      <nametext>b</nametext>
    </itemname>
    <item>
      <itemname nametype="multiple">
        <nametext>i</nametext>
      </itemname>
      <item>
        <itemname nametype="multiple">
          <nametext>v</nametext>
        </itemname>
      </item>
    </item>
    <item>
      <itemname nametype="multiple">
        <nametext>j</nametext>
      </itemname>
    </item>
  </item>
  <item>
    <itemname nametype="simple">
      <nametext>c</nametext>
    </itemname>
  </item>
</xml>  



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>