Re: [xsl] How to make this XSLT works for more than two section

Subject: Re: [xsl] How to make this XSLT works for more than two section
From: Wolfgang Laun <wolfgang.laun@xxxxxxxxx>
Date: Wed, 13 Jun 2012 14:43:17 +0200
I find that I get the desired output, except for the last item1, which
is also removed, but that has a matching predecessor, i.e., the second
item1 in the output.
-W

On 13/06/2012, Jo Na <jkoe888@xxxxxxxxx> wrote:

> And desired Output:
> <myroot>
>     <RNC>
>         <nodeA id="a">
>             <section id="i">
>                 <item1 id="0" method="delete"/>
>                 <item1 id="1" method="create">
>                     <otherchild>a</otherchild>
>                 </item1>
>             </section>
>             <section id="i">
>                 <item1 id="0" method="delete"> <!-- third consecutive
> delete BUT children have different value , so we don't remove this -->
>                     <somechild>bbb</somechild>
>                 </item1>
>                 <item1 id="3" method="create">
>                     <other>xx</other>
>                 </item1>
>                 <item1 id="0" method="create">
>                     <otherchild>a</otherchild>
>                 </item1>
>             </section>
>             <section id="i">
>                 <item1 id="1" method="create">
>                     <otherchild>a</otherchild>
>                 </item1>
>             </section>
>         </nodeA>
>     </RNC>
> </myroot>
>
> How to fix the XSLT to apply to more than two sections with the same
> id as shown on the example. (right now the algorithm works fine for
> only two sections with the same id)
>
> The objective is to remove node with successive duplicate with the
> same element name item1 item2 etc, same id and same method.
> An XML node followed by other node with exact same element name, same
> id, same method and same children will be considered duplicate.
> if the two nodes being compared did not share the same 'nodeA' level
> node, then they should not be considered as duplicates to be removed
>
> Thank you.
> Jo

Current Thread