Re: Help needed in recursively converting the flat xml to a heirarchical XML
2004-03-26 18:20:17
Hi Wendell,
Thanks for the quick response.As I told in my earlier post that I am still a
beginner in xsl and till now I haven't used the keys in order to use the
solution you preferred.
Here is the exact logic for nesting of the nodes...
1. As you can see my input xml consists of
<concurrent-block/fork/transition> nodes which has attribute value (@to). I
have to look for all the <activity-state> nodes with the same value in
(@name), and if matched, move the <activity-state> to <concurrent-block>,
else I have retain them at the same place.
2. Secondly, inturn the <activity-state> also has <transition> node which
can have values related to another <activity-state> node and/or <join> node
or <concurrent-block> node. If any matches are found then I have to move all
of them to the <concurrent-block> node.
3. If a <concurrent-block> node is found in the second step, that has to
have all the related <activity-state> nodes, <join> nodes etc., with in its
block.
4. One or More <activity-state> nodes will refer to the same <join> node but
I need only one occurance of the <join> irrespective of how many
<activity-state> nodes are refering it. The basic rule is "Each
<concurrent-block> should contain only one <join> node."
Hope this will give you the exact situation on which I am working on. I
would really appreciate your help in this regard.
Thanks
Sridhar Anupindi
From: Wendell Piez <wapiez(_at_)mulberrytech(_dot_)com> >Reply-To:
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com >To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
>Subject: Re: [xsl] Help needed in recursively converting the flat xml to
a heirarchical XML >Date: Fri, 26 Mar 2004 18:20:45 -0500 > >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
>====================================================================== >
> >--+------------------------------------------------------------------
>XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list >To
unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/ >or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com> >--+-- >
_________________________________________________________________
Join BharatMatrimony.com.
http://www.bharatmatrimony.com/cgi-bin/bmclicks1.cgi?72 Unmarried? Join
Free.
|
|