[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Sorting and Merge


Subject: Re: [xsl] Sorting and Merge
From: Dongling Ding <dling61@xxxxxxxxx>
Date: Mon, 17 Nov 2003 11:44:53 -0800 (PST)

Thank Dimitre,

Let me give a clearer description of the problem.

We have a member structure and allow users to define
filters based on it. We can generate the result after
applying those filters. But the problem is that result
is messed up since the filter was applied
sequentially.


Here is an example of the original member structure.
The actual structure can be very deep in terms of
hierarchy.


<MemberList>
    <Member name="P1">
	<Member name="P11">
			<Member name="P111"/>
	</Member>
	<Member name="P12">
			<Member name="P121"/>
	</Member>
    </Member>
    <Member name="P2">
		<Member name="P21"/>
                <Member name="P22"/>
    </Member>
</MemberList>

Here there are three filers created by user:

1. select the member name "P121" and its ancestors.
They are P121, P12, and P1.
2. select the member name "P2" and its children. They
are P2, P21, and P22.
2. select the member name "P1" and its children. So,
P1, P11, and P21,

After those filters are applied sequentially, we got
the following result, but it contains duplicated
members and order of members is not the same as
original one.

<MemberList>
<Member name="P1">
	<Member name="P12">
		<Member name="P121"/>
	</Member>
</Member>
<Member name="P2">
		<Member name="P21"/>
                <Member name="P22"/>
</Member>
<Member name="P1">
	<Member name="P11"/>
	<Member name="P12"/>
</Member>
</MemberList>

Therefore, the transformation requirement is to merge
and reorder the above result based on the original
member structure. Dimitre suggested earlier to add one
attribute "_pos" to indicate the member position in
the above result. It looks like this:

<Member _pos="1" name="P1"/>

It helps when we have one or two levels. But we need
to go down each level and figure out the
position(recursive)and get rid of duplicate members.
This transformation seems doing merge and sorting.
Please help me on this!


Thanks


Dongling






__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords