xslt compare two different nodes and then combine

后端 未结 2 1149
栀梦
栀梦 2021-01-21 21:18

I have a requirement where i need to show the difference amount () based on two different values which is in different section.The input xml as b

2条回答
  •  广开言路
    2021-01-21 21:47

    Try following solution based on Muenchian grouping. The TXLifeRequest are grouped by FundCode and AccountNumber.

    It shout work even if there are more than two entries in the group. All Data for a group output (especial ReversalInd) is from the one with the highest TotalAmount. The value of TotalAmount is the difference of the first (highest) TotalAmount and the remaining ones.

    It also considers the request: "And also if you observe the that is CR/DR should be identified based on highest TotalAmount value."

    xsl:stylesheet version="1.0" 
                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:ns="http://ACORD.org/Standards/Life/2">
    
    
    
        
    
        
    
            
                
            
        
    
        
            
    
                
                    
                        
                        
                            
                            
                                
                                
                                    
                                
                            
                        
                    
                
            
        
    
    
    

    Which will generate following output:

    
      
        LTRW00
        34142
        Cr
        1250
      
      
        LUL500
        34142
        Dr
        300
      
    
    

    Update for additional request to calculate a GrandTotal:

    
    
    
    
        
    
        
    
            
                
            
        
    
        
            
                
                    
                        
                        
                            
                            
    
                                
                                
                                    
                                
                            
                        
                    
    
                
                
                    
                        
                
                
            
        
    
        
            
            
            
            
                
                        
                        
                            
                            
                                
                                
                                    
                                    
                                    
                                
                            
                        
                
                
                    
                
            
        
    
    
    

提交回复
热议问题