[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

recursions?

Subject: recursions?
From: Dennis Luemkemann <dll@xxxxxxxxxxxxxx>
Date: Wed, 20 Jun 2001 12:47:39 -0400
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.