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

RE: creating XML hierarchy where not existed before??

Subject: RE: creating XML hierarchy where not existed before??
From: "Meltsner, Kenneth" <Kenneth.Meltsner@xxxxxx>
Date: Mon, 18 Dec 2000 14:27:51 -0500
xml recursive hierarchy
It can be solved in XML.

Basically, you can do it with recursion:

For each starting element (e.g. group1), you process it by emitting the start of a element of level n, processing the input element itself, and calling a recursive template to process the following element of level n+1.

The recursive template checks whether the element passed to it is of the n+1 level; if so, it processes it (probably with another pair of a level-x template and a recursive template) and calls itself with the next element.  If it's level n, terminate.

Control then returns to the template that called the recursive template, the closing tag of level n is output, and the template ends.

Or something like this:


<level1>
process the group1 element
call-template [process-level1] with the next element
</level1>


process-level1 does the following if:

[group1] -> return without doing anything
[group2] -> process group2, call-template level1 with the next element (forward-sibling)

and so forth.  Variations come from whether levels can be missing (a group4 following a group2), multiple group n's in a row, etc.

Ken Meltsner

 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.