This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
recursions?
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] recursions?
- From: Dennis Luemkemann <dll at goldencode dot com>
- Date: Wed, 20 Jun 2001 12:47:39 -0400
- Reply-To: xsl-list at lists dot mulberrytech dot com
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