XSL - Get SUM of price

前端 未结 2 847
花落未央
花落未央 2021-01-07 13:14

I have a xml structure like:

 1481 test1 test2 

        
2条回答
  •  灰色年华
    2021-01-07 14:13

    As I understand I need transform price to "normal view (without + and -)" before a send it to function "sum".

    That is more or less correct (you don't want to remove the minus sign, in case the number is negative). Given a well-formed input such as:

    XML

    
      
        1481
        test1
        test2
        +798.27
      
      
        0741
        test2
        test2
        +399.14
      
    
    

    the following stylesheet:

    XSLT 1.0

    
    
    
    
        
            
                
                    
                
            
        
        
            
        
    
    
    
    

    will return:

    
    1197.41
    

提交回复
热议问题