XML : XFORMS: Delete some nodes based on values in another instance

In my main instance I have a set of nodes as follows:

Main instance

   <Items>      <Item>         <Id>2</Id>      </Item>      <Item>         <Id>3</Id>      </Item>      <Item>         <Id>4</Id>      </Item>      <Item>         <Id>5</Id>      </Item>   </Items>    

And another (similar) instance with values such as:

Other instance

   <Items>      <Item>         <Id>4</Id>      </Item>      <Item>         <Id>5</Id>      </Item>      <Item>         <Id>6</Id>      </Item>   </Items>    

Now I want to delete all items in the Main instance, that don't have a corresponding entry in the other Instance, so the main instance will then look like:

   <Items>      <Item>         <Id>4</Id>      </Item>      <Item>         <Id>5</Id>      </Item>   </Items>    

Then I want to delete all items in the other instance that DO exist in the main instance, so the other instance will look like:

   <Items>      <Item>         <Id>6</Id>      </Item>   </Items>    

I'm struggling with the syntax to accomplish this. thanks in advance Peter

No comments:

Post a Comment