This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

recursions?



I have an XML source like this (simplified):
...
<parent>
   <field>
   <group>
      <field/>
      <group>
         <field/>
      </group>
      <field/>
      ...
   </group>
   <field/>
   ...
</parent>
...

where the order of field and group elements is variable and the nesting
of groups can be infinite.  The order of appearance in the tree is very
important.  Now I'm using a for-each descendant::* construct from the
parent node to process all elements.  This works fine as long as I just
want a "flat" output.  But I want a hierarchical output, somewhat like
this:

FIELD
blabla, blabla

GROUP
blabla
   FIELD
   blabla, blabla
   FIELD
   ....
   GROUP
   ...
      FIELD
      ...

FIELD
...

Since the template doesn't know in which level of the hierarchy it is,
it can't indent the output correctly.

How would you do this?  Is there a way to recursively traverse the
nodes?  So when I'm at a group node, it would call a template to check
again for group and field and branch off from there recursively?

Thanks for any suggestions

Dennis


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]