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

Re: [xsl] How to do this tricky elimination on XML using XSLT 2.0?


Subject: Re: [xsl] How to do this tricky elimination on XML using XSLT 2.0?
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Tue, 19 Jun 2012 11:08:04 +0100

> I need to remove a node that are considered as *repetitive*.
>
> **Two node that have the same `name` and `id` will be considered
> *repetitive* if it appears one after another and it has the same
> `method` and `children`.**
>
> **for example:**
>
>     <elem id="1" method="a" />
>     <elem id="1" method="a" /> <!-- this is repetitive for id=1-->
>     <elem id="1" method="b" />
>     <elem id="1" method="a" /> <!-- this is the new boundary for removal
id=1-->
>     <elem id="2" method="a" />
>     <elem id="1" method="a" /> <!-- this is repetitive for id=1 -->
>     <elem id="2" method="a" /> <!-- this is repetitive for id=2 -->
>
> **will be simplified into:**
>
>     <elem id="1" method="a" />
>     <elem id="1" method="b" />
>     <elem id="1" method="a" /> <!-- this is the new boundary for removal
id=1-->
>     <elem id="2" method="a" />

This looks like its a group-adjacent or sibling-recursion problem,
sorry I can't look into it more but that might help get you going.



--
Andrew Welch
http://andrewjwelch.com


Current Thread