compare two xml files with xslt?

前端 未结 3 802
萌比男神i
萌比男神i 2021-02-10 13:12

I have 2 xml files. How can I compare both files are equal or not by using xslt? If not equal means where the changes havebeen occur in the second xml?

3条回答
  •  無奈伤痛
    2021-02-10 14:05

    In XPath 2.0 you could simple use fn:deep-equal.

    Following the same pattern in XSLT 1.0, this stylesheet:

    
        
        
            
                
                    
                
            
            
                
                    Documents are different
                
                
                    Documents are deep equal
                
            
        
        
            
            
                
                    
                        
                            false
                        
                    
                    
                        
                        
                            
                        
                    
                
                false
            
        
        
            
            
                false
            
        
    
    

    Output:

    Documents are different
    

提交回复
热议问题