xsl-list
[Top] [All Lists]

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

2012-06-13 07:43:28
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(_at_)gmail(_dot_)com> 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

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--