xsl-list
[Top] [All Lists]

Re: Help needed in recursively converting the flat xml to a heirarchical XML

2004-03-26 16:20:45
Sridhar,

I'm afraid I don't have time to provide a worked-out solution, largely because without boiling down the problem to its essentials, I can't construe the exact nesting logic you require.

I can suggest, however, that you don't need recursion. Rather, you can use keys to associate the nodes you need nested with those they need to be nested with. Commonly with this type of problem, this association is done either by nodes' proximity (e.g. all <p> elements with their closest preceding <head> element, to nest them into sections), or by values such as attribute values (which I think you could use).

Check out the FAQ page at http://www.dpawson.co.uk/xsl/sect2/flatfile.html, where this technique is demonstrated in several different scenarios.

If it isn't readily apparent to you how you can construct keys to induce the required nested structures, please post again, perhaps with a bit of explanation of what the exact grouping (nesting) requirements are for your data, to help us with the analysis. (This is actually a kind of grouping problem, after all.)

Good luck,
Wendell

At 05:46 PM 3/26/2004, you wrote:
I am trying to arrange the following flat XML into a heirarchical XML
File using recursion. Since I am a beginner in XSL, I need someone to
help out in this task.


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================