How to remove duplicate XML nodes using XSLT

前端 未结 3 654
日久生厌
日久生厌 2020-12-03 19:47

I\'ve got an extremely long XML file, like


   
      context1
      test1
         


        
3条回答
  •  执念已碎
    2020-12-03 20:25

    If the OP's provided XML is representative of his/her question (and the 2nd inside each element should be removed), then Muenchian Grouping isn't necessary:

    XSLT:

    
    
      
      
    
      
      
        
          
        
      
    
      
      
    
    
    

    When run against the provided XML:

    
    
      
        context1
        test1
        context1
      
      
        context2
        test2
        context2
      
    
    

    ...the desired result is produced:

    
    
      
        context1
        test1
      
      
        context2
        test2
      
    
    

提交回复
热议问题