XSL - Get SUM of price

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

I have a xml structure like:

 1481 test1 test2 

        
2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-07 14:01

    This transformation doesn't require the use of any extension functions and doesn't produce an intermediary tree -- in fact it runs with 0 additional memory and is suitable for streaming, if the XSLT processor recognizes tail-recursion:

    
     
    
     
       
         
       
     
    
     
      
      
      
    
      
      
        
        
      
     
    
    

    When it is applied on the provided XML document:

    
      
        1481
        test1
        test2
        +798.27
      
      
        0741
        test2
        test2
        +399.14
      
    
    

    The wanted, correct result is produced:

    1187.4099999999998
    

提交回复
热议问题